-- ---------- -- txid.sql -- -- SQL script for loading the transaction ID compatible datatype -- -- Copyright (c) 2003-2007, PostgreSQL Global Development Group -- Author: Jan Wieck, Afilias USA INC. -- 64-bit txids: Marko Kreen, Skype Technologies -- -- $PostgreSQL: pgsql/contrib/txid/txid.sql.in,v 1.2 2007/10/11 19:54:17 tgl Exp $ -- -- ---------- -- Adjust this setting to control where the objects get created. SET search_path = public; BEGIN; -- -- A special transaction snapshot data type for faster visibility checks -- CREATE TYPE txid_snapshot; CREATE FUNCTION txid_snapshot_in(cstring) RETURNS txid_snapshot AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION txid_snapshot_out(txid_snapshot) RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION txid_snapshot_recv(internal) RETURNS txid_snapshot AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION txid_snapshot_send(txid_snapshot) RETURNS bytea AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -- -- The data type itself -- CREATE TYPE txid_snapshot ( INPUT = txid_snapshot_in, OUTPUT = txid_snapshot_out, RECEIVE = txid_snapshot_recv, SEND = txid_snapshot_send, INTERNALLENGTH = variable, STORAGE = extended, ALIGNMENT = double ); -- -- Functions for txid -- CREATE FUNCTION txid_current() RETURNS bigint AS 'MODULE_PATHNAME', 'txid_current' LANGUAGE C STABLE; CREATE FUNCTION txid_current_snapshot() RETURNS txid_snapshot AS 'MODULE_PATHNAME', 'txid_current_snapshot' LANGUAGE C STABLE; CREATE FUNCTION txid_snapshot_xmin(txid_snapshot) RETURNS bigint AS 'MODULE_PATHNAME', 'txid_snapshot_xmin' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION txid_snapshot_xmax(txid_snapshot) RETURNS bigint AS 'MODULE_PATHNAME', 'txid_snapshot_xmax' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION txid_snapshot_xip(txid_snapshot) RETURNS setof bigint AS 'MODULE_PATHNAME', 'txid_snapshot_xip' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION txid_visible_in_snapshot(bigint, txid_snapshot) RETURNS boolean AS 'MODULE_PATHNAME', 'txid_visible_in_snapshot' LANGUAGE C IMMUTABLE STRICT; COMMIT;