diff --git a/contrib/btree_gist/btree_gist.sql.in b/contrib/btree_gist/btree_gist.sql.in index dbb68c7c748ab364a00bb7611e6fe538aa6f7daa..a60a7c2706f0f38c832164e1f9907659511a32d8 100644 --- a/contrib/btree_gist/btree_gist.sql.in +++ b/contrib/btree_gist/btree_gist.sql.in @@ -4,13 +4,13 @@ begin transaction; SET search_path = public; -- create type of int4 key -CREATE FUNCTION int4key_in(opaque) -RETURNS opaque +CREATE FUNCTION int4key_in(cstring) +RETURNS int4key AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION int4key_out(opaque) -RETURNS opaque +CREATE FUNCTION int4key_out(int4key) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -29,19 +29,19 @@ output = int4key_out -- -- -- define the GiST support methods -create function gint4_consistent(opaque,int4,int2) returns bool as 'MODULE_PATHNAME' language 'C'; +create function gint4_consistent(internal,int4,int2) returns bool as 'MODULE_PATHNAME' language 'C'; -create function gint4_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gint4_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C'; -create function btree_decompress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function btree_decompress(internal) returns internal as 'MODULE_PATHNAME' language 'C'; -create function gint4_penalty(opaque,opaque,opaque) returns opaque as 'MODULE_PATHNAME' language 'C' with(isstrict); +create function gint4_penalty(internal,internal,internal) returns internal as 'MODULE_PATHNAME' language 'C' with(isstrict); -create function gint4_picksplit(opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gint4_picksplit(internal, internal) returns internal as 'MODULE_PATHNAME' language 'C'; -create function gint4_union(bytea, opaque) returns int4 as 'MODULE_PATHNAME' language 'C'; +create function gint4_union(bytea, internal) returns int4 as 'MODULE_PATHNAME' language 'C'; -create function gint4_same(opaque, opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gint4_same(internal, internal, internal) returns internal as 'MODULE_PATHNAME' language 'C'; -- Create the operator class CREATE OPERATOR CLASS gist_int4_ops @@ -51,13 +51,13 @@ CREATE OPERATOR CLASS gist_int4_ops OPERATOR 3 = , OPERATOR 4 >= , OPERATOR 5 > , - FUNCTION 1 gint4_consistent (opaque, int4, int2), - FUNCTION 2 gint4_union (bytea, opaque), - FUNCTION 3 gint4_compress (opaque), - FUNCTION 4 btree_decompress (opaque), - FUNCTION 5 gint4_penalty (opaque, opaque, opaque), - FUNCTION 6 gint4_picksplit (opaque, opaque), - FUNCTION 7 gint4_same (opaque, opaque, opaque), + FUNCTION 1 gint4_consistent (internal, int4, int2), + FUNCTION 2 gint4_union (bytea, internal), + FUNCTION 3 gint4_compress (internal), + FUNCTION 4 btree_decompress (internal), + FUNCTION 5 gint4_penalty (internal, internal, internal), + FUNCTION 6 gint4_picksplit (internal, internal), + FUNCTION 7 gint4_same (internal, internal, internal), STORAGE int4key; @@ -70,13 +70,13 @@ CREATE OPERATOR CLASS gist_int4_ops -- -- create type of timestamp key -CREATE FUNCTION tskey_in(opaque) -RETURNS opaque +CREATE FUNCTION tskey_in(cstring) +RETURNS tskey AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION tskey_out(opaque) -RETURNS opaque +CREATE FUNCTION tskey_out(tskey) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -86,17 +86,17 @@ input = tskey_in, output = tskey_out ); -create function gts_consistent(opaque,timestamp,int2) returns bool as 'MODULE_PATHNAME' language 'C'; +create function gts_consistent(internal,timestamp,int2) returns bool as 'MODULE_PATHNAME' language 'C'; -create function gts_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gts_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C'; -create function gts_penalty(opaque,opaque,opaque) returns opaque as 'MODULE_PATHNAME' language 'C' with(isstrict); +create function gts_penalty(internal,internal,internal) returns internal as 'MODULE_PATHNAME' language 'C' with(isstrict); -create function gts_picksplit(opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gts_picksplit(internal, internal) returns internal as 'MODULE_PATHNAME' language 'C'; -create function gts_union(bytea, opaque) returns int4 as 'MODULE_PATHNAME' language 'C'; +create function gts_union(bytea, internal) returns int4 as 'MODULE_PATHNAME' language 'C'; -create function gts_same(opaque, opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gts_same(internal, internal, internal) returns internal as 'MODULE_PATHNAME' language 'C'; -- Create the operator class CREATE OPERATOR CLASS gist_timestamp_ops @@ -106,13 +106,13 @@ CREATE OPERATOR CLASS gist_timestamp_ops OPERATOR 3 = , OPERATOR 4 >= , OPERATOR 5 > , - FUNCTION 1 gts_consistent (opaque, timestamp, int2), - FUNCTION 2 gts_union (bytea, opaque), - FUNCTION 3 gts_compress (opaque), - FUNCTION 4 btree_decompress (opaque), - FUNCTION 5 gts_penalty (opaque, opaque, opaque), - FUNCTION 6 gts_picksplit (opaque, opaque), - FUNCTION 7 gts_same (opaque, opaque, opaque), + FUNCTION 1 gts_consistent (internal, timestamp, int2), + FUNCTION 2 gts_union (bytea, internal), + FUNCTION 3 gts_compress (internal), + FUNCTION 4 btree_decompress (internal), + FUNCTION 5 gts_penalty (internal, internal, internal), + FUNCTION 6 gts_picksplit (internal, internal), + FUNCTION 7 gts_same (internal, internal, internal), STORAGE tskey; diff --git a/contrib/chkpass/chkpass.sql.in b/contrib/chkpass/chkpass.sql.in index 72ad5e559caa88cb363e626cbba7f4040fbb83e6..3e331509d7c5d8ba76eeea0a516e585b23552062 100644 --- a/contrib/chkpass/chkpass.sql.in +++ b/contrib/chkpass/chkpass.sql.in @@ -4,7 +4,7 @@ -- darcy@druid.net -- http://www.druid.net/darcy/ -- --- $Header: /cvsroot/pgsql/contrib/chkpass/chkpass.sql.in,v 1.1 2001/08/23 16:50:33 tgl Exp $ +-- $Header: /cvsroot/pgsql/contrib/chkpass/chkpass.sql.in,v 1.2 2002/08/22 00:01:38 tgl Exp $ -- -- best viewed with tabs set to 4 -- @@ -13,13 +13,13 @@ -- Input and output functions and the type itself: -- -create function chkpass_in(opaque) - returns opaque +create function chkpass_in(cstring) + returns chkpass as 'MODULE_PATHNAME' language 'c'; -create function chkpass_out(opaque) - returns opaque +create function chkpass_out(chkpass) + returns cstring as 'MODULE_PATHNAME' language 'c'; diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index b0b479016a78ae55bda3c42326d39e9ae4768700..afd69029c95b9d206c8937bcdd46a10f4f461564 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -99,14 +99,6 @@ cube_in(char *str) return ((NDBOX *) result); } -/* - * You might have noticed a slight inconsistency between the following - * declaration and the SQL definition: - * CREATE FUNCTION cube_out(opaque) RETURNS opaque ... - * The reason is that the argument pass into cube_out is really just a - * pointer. POSTGRES thinks all output functions are: - * char *out_func(char *); - */ char * cube_out(NDBOX *cube) { diff --git a/contrib/cube/cube.sql.in b/contrib/cube/cube.sql.in index 0637fbedfd9e4d6e826175dc397083539be9444e..5889c687a58fb059d8ee7e49511ab9564dde255a 100644 --- a/contrib/cube/cube.sql.in +++ b/contrib/cube/cube.sql.in @@ -5,13 +5,13 @@ BEGIN TRANSACTION; -- Adjust this setting to control where the objects get created. SET search_path = public; -CREATE FUNCTION cube_in(opaque) -RETURNS opaque +CREATE FUNCTION cube_in(cstring) +RETURNS cube AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict); -CREATE FUNCTION cube_out(opaque) -RETURNS opaque +CREATE FUNCTION cube_out(cube) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict); @@ -192,25 +192,25 @@ CREATE OPERATOR ~ ( -- define the GiST support methods -CREATE FUNCTION g_cube_consistent(opaque,cube,int4) RETURNS bool +CREATE FUNCTION g_cube_consistent(internal,cube,int4) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_cube_compress(opaque) RETURNS opaque +CREATE FUNCTION g_cube_compress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_cube_decompress(opaque) RETURNS opaque +CREATE FUNCTION g_cube_decompress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_cube_penalty(opaque,opaque,opaque) RETURNS opaque +CREATE FUNCTION g_cube_penalty(internal,internal,internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION g_cube_picksplit(opaque, opaque) RETURNS opaque +CREATE FUNCTION g_cube_picksplit(internal, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_cube_union(bytea, opaque) RETURNS cube +CREATE FUNCTION g_cube_union(bytea, internal) RETURNS cube AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_cube_same(cube, cube, opaque) RETURNS opaque +CREATE FUNCTION g_cube_same(cube, cube, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; @@ -226,13 +226,13 @@ CREATE OPERATOR CLASS gist_cube_ops OPERATOR 6 = , OPERATOR 7 @ , OPERATOR 8 ~ , - FUNCTION 1 g_cube_consistent (opaque, cube, int4), - FUNCTION 2 g_cube_union (bytea, opaque), - FUNCTION 3 g_cube_compress (opaque), - FUNCTION 4 g_cube_decompress (opaque), - FUNCTION 5 g_cube_penalty (opaque, opaque, opaque), - FUNCTION 6 g_cube_picksplit (opaque, opaque), - FUNCTION 7 g_cube_same (cube, cube, opaque); + FUNCTION 1 g_cube_consistent (internal, cube, int4), + FUNCTION 2 g_cube_union (bytea, internal), + FUNCTION 3 g_cube_compress (internal), + FUNCTION 4 g_cube_decompress (internal), + FUNCTION 5 g_cube_penalty (internal, internal, internal), + FUNCTION 6 g_cube_picksplit (internal, internal), + FUNCTION 7 g_cube_same (cube, cube, internal); END TRANSACTION; diff --git a/contrib/dbmirror/MirrorSetup.sql b/contrib/dbmirror/MirrorSetup.sql index b28b8e4104a3308d628d926c8374bcb46805a672..8e03264165090ad9d7806ce36e97a97d77bd45cf 100644 --- a/contrib/dbmirror/MirrorSetup.sql +++ b/contrib/dbmirror/MirrorSetup.sql @@ -1,5 +1,5 @@ -CREATE FUNCTION "recordchange" () RETURNS opaque AS +CREATE FUNCTION "recordchange" () RETURNS trigger AS '/usr/local/pgsql/lib/pending.so', 'recordchange' LANGUAGE 'C'; CREATE TABLE "MirrorHost" ( diff --git a/contrib/fulltextindex/README.fti b/contrib/fulltextindex/README.fti index 5c3d6362a6b49ee88f3127b07fa306dfface9024..cdf15c24da911093ef124050bbfc6f4ea4d60346 100644 --- a/contrib/fulltextindex/README.fti +++ b/contrib/fulltextindex/README.fti @@ -58,7 +58,7 @@ sub-string will fit. The create the function that contains the trigger:: - create function fti() returns opaque as + create function fti() returns trigger as '/path/to/fti.so' language 'C'; And finally define the trigger on the 'cds' table: diff --git a/contrib/fulltextindex/fti.c b/contrib/fulltextindex/fti.c index 8050f2a9d72603a00de68f0afe952a33d9d5514a..0c4cceb3f59cc4bc97113c2270d8fafbf764fac7 100644 --- a/contrib/fulltextindex/fti.c +++ b/contrib/fulltextindex/fti.c @@ -21,7 +21,7 @@ * Example: * * -- Create the SQL function based on the compiled shared object - * create function fti() returns opaque as + * create function fti() returns trigger as * '/usr/local/pgsql/lib/contrib/fti.so' language 'C'; * * -- Create the FTI table diff --git a/contrib/fulltextindex/fti.pl b/contrib/fulltextindex/fti.pl index 58080a5425cbfae55473a1ef9422b964ee741b5b..5b660ed815f5568b14ca35344a625e6a6bc0620a 100644 --- a/contrib/fulltextindex/fti.pl +++ b/contrib/fulltextindex/fti.pl @@ -27,7 +27,7 @@ # # create index fti_idx on my_fti_table (string,id); # -# create function fti() returns opaque as +# create function fti() returns trigger as # '/path/to/fti/file/fti.so' # language 'C'; # diff --git a/contrib/fulltextindex/fti.sql.in b/contrib/fulltextindex/fti.sql.in index e0da2353c52447eb1b019fb516d827abf4842c21..c8e705b90f96d17275871998fe8a254e3cda17a7 100644 --- a/contrib/fulltextindex/fti.sql.in +++ b/contrib/fulltextindex/fti.sql.in @@ -1,3 +1,3 @@ -create function fti() returns opaque as +create function fti() returns trigger as 'MODULE_PATHNAME' language 'C'; \ No newline at end of file diff --git a/contrib/intarray/_int.sql.in b/contrib/intarray/_int.sql.in index fe1a6f9d389b05efc26bdceef635afb9673a03e5..7f9a8082ca479c3de10c56fd583dde4ebb6b3cb7 100644 --- a/contrib/intarray/_int.sql.in +++ b/contrib/intarray/_int.sql.in @@ -7,13 +7,13 @@ BEGIN TRANSACTION; SET search_path = public; -- Query type -CREATE FUNCTION bqarr_in(opaque) -RETURNS opaque +CREATE FUNCTION bqarr_in(cstring) +RETURNS query_int AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION bqarr_out(opaque) -RETURNS opaque +CREATE FUNCTION bqarr_out(query_int) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -200,25 +200,25 @@ CREATE OPERATOR & ( -------------- -- define the GiST support methods -CREATE FUNCTION g_int_consistent(opaque,_int4,int4) RETURNS bool +CREATE FUNCTION g_int_consistent(internal,_int4,int4) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_int_compress(opaque) RETURNS opaque +CREATE FUNCTION g_int_compress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_int_decompress(opaque) RETURNS opaque +CREATE FUNCTION g_int_decompress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_int_penalty(opaque,opaque,opaque) RETURNS opaque +CREATE FUNCTION g_int_penalty(internal,internal,internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION g_int_picksplit(opaque, opaque) RETURNS opaque +CREATE FUNCTION g_int_picksplit(internal, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_int_union(bytea, opaque) RETURNS _int4 +CREATE FUNCTION g_int_union(bytea, internal) RETURNS _int4 AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_int_same(_int4, _int4, opaque) RETURNS opaque +CREATE FUNCTION g_int_same(_int4, _int4, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; @@ -231,38 +231,38 @@ CREATE OPERATOR CLASS gist__int_ops OPERATOR 7 @, OPERATOR 8 ~, OPERATOR 20 @@ (_int4, query_int), - FUNCTION 1 g_int_consistent (opaque, _int4, int4), - FUNCTION 2 g_int_union (bytea, opaque), - FUNCTION 3 g_int_compress (opaque), - FUNCTION 4 g_int_decompress (opaque), - FUNCTION 5 g_int_penalty (opaque, opaque, opaque), - FUNCTION 6 g_int_picksplit (opaque, opaque), - FUNCTION 7 g_int_same (_int4, _int4, opaque); + FUNCTION 1 g_int_consistent (internal, _int4, int4), + FUNCTION 2 g_int_union (bytea, internal), + FUNCTION 3 g_int_compress (internal), + FUNCTION 4 g_int_decompress (internal), + FUNCTION 5 g_int_penalty (internal, internal, internal), + FUNCTION 6 g_int_picksplit (internal, internal), + FUNCTION 7 g_int_same (_int4, _int4, internal); --------------------------------------------- -- intbig --------------------------------------------- -- define the GiST support methods -CREATE FUNCTION g_intbig_consistent(opaque,_int4,int4) RETURNS bool +CREATE FUNCTION g_intbig_consistent(internal,_int4,int4) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_intbig_compress(opaque) RETURNS opaque +CREATE FUNCTION g_intbig_compress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_intbig_decompress(opaque) RETURNS opaque +CREATE FUNCTION g_intbig_decompress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_intbig_penalty(opaque,opaque,opaque) RETURNS opaque +CREATE FUNCTION g_intbig_penalty(internal,internal,internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION g_intbig_picksplit(opaque, opaque) RETURNS opaque +CREATE FUNCTION g_intbig_picksplit(internal, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_intbig_union(bytea, opaque) RETURNS _int4 +CREATE FUNCTION g_intbig_union(bytea, internal) RETURNS _int4 AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION g_intbig_same(_int4, _int4, opaque) RETURNS opaque +CREATE FUNCTION g_intbig_same(_int4, _int4, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -- register the opclass for indexing (not as default) @@ -274,12 +274,12 @@ CREATE OPERATOR CLASS gist__intbig_ops OPERATOR 7 @ RECHECK, OPERATOR 8 ~ RECHECK, OPERATOR 20 @@ (_int4, query_int) RECHECK, - FUNCTION 1 g_intbig_consistent (opaque, _int4, int4), - FUNCTION 2 g_intbig_union (bytea, opaque), - FUNCTION 3 g_intbig_compress (opaque), - FUNCTION 4 g_intbig_decompress (opaque), - FUNCTION 5 g_intbig_penalty (opaque, opaque, opaque), - FUNCTION 6 g_intbig_picksplit (opaque, opaque), - FUNCTION 7 g_intbig_same (_int4, _int4, opaque); + FUNCTION 1 g_intbig_consistent (internal, _int4, int4), + FUNCTION 2 g_intbig_union (bytea, internal), + FUNCTION 3 g_intbig_compress (internal), + FUNCTION 4 g_intbig_decompress (internal), + FUNCTION 5 g_intbig_penalty (internal, internal, internal), + FUNCTION 6 g_intbig_picksplit (internal, internal), + FUNCTION 7 g_intbig_same (_int4, _int4, internal); END TRANSACTION; diff --git a/contrib/isbn_issn/isbn_issn.sql.in b/contrib/isbn_issn/isbn_issn.sql.in index 3a47621c2cac7bb5610a895244eeb579df57c70c..64767f8502e2a3a89a470ce89660a84b57e7995a 100644 --- a/contrib/isbn_issn/isbn_issn.sql.in +++ b/contrib/isbn_issn/isbn_issn.sql.in @@ -1,7 +1,7 @@ -- -- PostgreSQL code for ISSNs. -- --- $Id: isbn_issn.sql.in,v 1.5 2002/07/30 17:34:37 tgl Exp $ +-- $Id: isbn_issn.sql.in,v 1.6 2002/08/22 00:01:39 tgl Exp $ -- -- Adjust this setting to control where the objects get created. @@ -12,13 +12,13 @@ SET search_path = public; -- Input and output functions and the type itself: -- -create function issn_in(opaque) - returns opaque +create function issn_in(cstring) + returns issn as 'MODULE_PATHNAME' language 'c'; -create function issn_out(opaque) - returns opaque +create function issn_out(issn) + returns cstring as 'MODULE_PATHNAME' language 'c'; @@ -123,19 +123,19 @@ create operator <> ( -- -- PostgreSQL code for ISBNs. -- --- $Id: isbn_issn.sql.in,v 1.5 2002/07/30 17:34:37 tgl Exp $ +-- $Id: isbn_issn.sql.in,v 1.6 2002/08/22 00:01:39 tgl Exp $ -- -- -- Input and output functions and the type itself: -- -create function isbn_in(opaque) - returns opaque +create function isbn_in(cstring) + returns isbn as 'MODULE_PATHNAME' language 'c'; -create function isbn_out(opaque) - returns opaque +create function isbn_out(isbn) + returns cstring as 'MODULE_PATHNAME' language 'c'; diff --git a/contrib/lo/lo.sql.in b/contrib/lo/lo.sql.in index f9fed597fd62d921866b5ad0b0468cac42ca0dc7..e60b46ce09e3226d3cfd0aa7d14d6a315ba206d7 100644 --- a/contrib/lo/lo.sql.in +++ b/contrib/lo/lo.sql.in @@ -1,21 +1,21 @@ -- -- PostgreSQL code for LargeObjects -- --- $Id: lo.sql.in,v 1.6 2000/11/21 21:51:58 tgl Exp $ +-- $Id: lo.sql.in,v 1.7 2002/08/22 00:01:39 tgl Exp $ -- -- -- Create the data type -- -- used by the lo type, it takes an oid and returns an lo object -create function lo_in(opaque) - returns opaque +create function lo_in(cstring) + returns lo as 'MODULE_PATHNAME' language 'c'; -- used by the lo type, it returns the oid of the object -create function lo_out(opaque) - returns opaque +create function lo_out(lo) + returns cstring as 'MODULE_PATHNAME' language 'c'; @@ -51,6 +51,6 @@ create function lo(oid) -- This is used in triggers create function lo_manage() - returns opaque + returns trigger as 'MODULE_PATHNAME' language 'c'; diff --git a/contrib/lo/lo_drop.sql b/contrib/lo/lo_drop.sql index 2472715a3d5779a55d08ddb82caf1accf8385724..4e4602836cef1f15305be771c05aedd2cc665f42 100644 --- a/contrib/lo/lo_drop.sql +++ b/contrib/lo/lo_drop.sql @@ -6,16 +6,10 @@ -- remove our test table drop table a; --- now drop any sql based functions associated with the lo type -drop function oid(lo); +-- now drop the type and associated C functions +drop type lo CASCADE; --- now drop the type -drop type lo; - --- as the type is gone, remove the C based functions -drop function lo_in(opaque); -drop function lo_out(opaque); -drop function lo(oid); +-- the trigger function has no dependency on the type, so drop separately drop function lo_manage(); -- the lo stuff is now removed from the system diff --git a/contrib/ltree/ltree.sql.in b/contrib/ltree/ltree.sql.in index 4e0f52ea1f6f3d3f8c77e569fe7b97fe1cf44fcc..ad7f61472b06a7cc747728f9e0f72628ea41be75 100644 --- a/contrib/ltree/ltree.sql.in +++ b/contrib/ltree/ltree.sql.in @@ -3,13 +3,13 @@ BEGIN; -- Adjust this setting to control where the objects get created. SET search_path = public; -CREATE FUNCTION ltree_in(opaque) -RETURNS opaque +CREATE FUNCTION ltree_in(cstring) +RETURNS ltree AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION ltree_out(opaque) -RETURNS opaque +CREATE FUNCTION ltree_out(ltree) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -232,13 +232,13 @@ CREATE OPERATOR CLASS ltree_ops --lquery type -CREATE FUNCTION lquery_in(opaque) -RETURNS opaque +CREATE FUNCTION lquery_in(cstring) +RETURNS lquery AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION lquery_out(opaque) -RETURNS opaque +CREATE FUNCTION lquery_out(lquery) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -284,13 +284,13 @@ CREATE OPERATOR ^~ ( RESTRICT = contsel, JOIN = contjoinsel ); -CREATE FUNCTION ltxtq_in(opaque) -RETURNS opaque +CREATE FUNCTION ltxtq_in(cstring) +RETURNS ltxtquery AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION ltxtq_out(opaque) -RETURNS opaque +CREATE FUNCTION ltxtq_out(ltxtquery) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -339,13 +339,13 @@ CREATE OPERATOR ^@ ( ); --GiST support for ltree -CREATE FUNCTION ltree_gist_in(opaque) -RETURNS opaque +CREATE FUNCTION ltree_gist_in(cstring) +RETURNS ltree_gist AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION ltree_gist_out(opaque) -RETURNS opaque +CREATE FUNCTION ltree_gist_out(ltree_gist) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -357,13 +357,13 @@ CREATE TYPE ltree_gist ( ); -create function ltree_consistent(opaque,opaque,int2) returns bool as 'MODULE_PATHNAME' language 'C'; -create function ltree_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; -create function ltree_decompress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; -create function ltree_penalty(opaque,opaque,opaque) returns opaque as 'MODULE_PATHNAME' language 'C' with(isstrict); -create function ltree_picksplit(opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; -create function ltree_union(bytea, opaque) returns int4 as 'MODULE_PATHNAME' language 'C'; -create function ltree_same(opaque, opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function ltree_consistent(internal,internal,int2) returns bool as 'MODULE_PATHNAME' language 'C'; +create function ltree_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C'; +create function ltree_decompress(internal) returns internal as 'MODULE_PATHNAME' language 'C'; +create function ltree_penalty(internal,internal,internal) returns internal as 'MODULE_PATHNAME' language 'C' with(isstrict); +create function ltree_picksplit(internal, internal) returns internal as 'MODULE_PATHNAME' language 'C'; +create function ltree_union(bytea, internal) returns int4 as 'MODULE_PATHNAME' language 'C'; +create function ltree_same(internal, internal, internal) returns internal as 'MODULE_PATHNAME' language 'C'; CREATE OPERATOR CLASS gist_ltree_ops DEFAULT FOR TYPE ltree USING gist AS @@ -378,13 +378,13 @@ CREATE OPERATOR CLASS gist_ltree_ops OPERATOR 13 ~ (lquery, ltree) , OPERATOR 14 @ (ltree, ltxtquery) , OPERATOR 15 @ (ltxtquery, ltree) , - FUNCTION 1 ltree_consistent (opaque, opaque, int2), - FUNCTION 2 ltree_union (bytea, opaque), - FUNCTION 3 ltree_compress (opaque), - FUNCTION 4 ltree_decompress (opaque), - FUNCTION 5 ltree_penalty (opaque, opaque, opaque), - FUNCTION 6 ltree_picksplit (opaque, opaque), - FUNCTION 7 ltree_same (opaque, opaque, opaque), + FUNCTION 1 ltree_consistent (internal, internal, int2), + FUNCTION 2 ltree_union (bytea, internal), + FUNCTION 3 ltree_compress (internal), + FUNCTION 4 ltree_decompress (internal), + FUNCTION 5 ltree_penalty (internal, internal, internal), + FUNCTION 6 ltree_picksplit (internal, internal), + FUNCTION 7 ltree_same (internal, internal, internal), STORAGE ltree_gist; @@ -566,12 +566,12 @@ CREATE OPERATOR ?@ ( ); --GiST support for ltree[] -create function _ltree_consistent(opaque,opaque,int2) returns bool as 'MODULE_PATHNAME' language 'C'; -create function _ltree_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; -create function _ltree_penalty(opaque,opaque,opaque) returns opaque as 'MODULE_PATHNAME' language 'C' with(isstrict); -create function _ltree_picksplit(opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; -create function _ltree_union(bytea, opaque) returns int4 as 'MODULE_PATHNAME' language 'C'; -create function _ltree_same(opaque, opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function _ltree_consistent(internal,internal,int2) returns bool as 'MODULE_PATHNAME' language 'C'; +create function _ltree_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C'; +create function _ltree_penalty(internal,internal,internal) returns internal as 'MODULE_PATHNAME' language 'C' with(isstrict); +create function _ltree_picksplit(internal, internal) returns internal as 'MODULE_PATHNAME' language 'C'; +create function _ltree_union(bytea, internal) returns int4 as 'MODULE_PATHNAME' language 'C'; +create function _ltree_same(internal, internal, internal) returns internal as 'MODULE_PATHNAME' language 'C'; CREATE OPERATOR CLASS gist__ltree_ops DEFAULT FOR TYPE _ltree USING gist AS @@ -581,13 +581,13 @@ CREATE OPERATOR CLASS gist__ltree_ops OPERATOR 13 ~ (lquery, _ltree) RECHECK , OPERATOR 14 @ (_ltree, ltxtquery) RECHECK , OPERATOR 15 @ (ltxtquery, _ltree) RECHECK , - FUNCTION 1 _ltree_consistent (opaque, opaque, int2), - FUNCTION 2 _ltree_union (bytea, opaque), - FUNCTION 3 _ltree_compress (opaque), - FUNCTION 4 ltree_decompress (opaque), - FUNCTION 5 _ltree_penalty (opaque, opaque, opaque), - FUNCTION 6 _ltree_picksplit (opaque, opaque), - FUNCTION 7 _ltree_same (opaque, opaque, opaque), + FUNCTION 1 _ltree_consistent (internal, internal, int2), + FUNCTION 2 _ltree_union (bytea, internal), + FUNCTION 3 _ltree_compress (internal), + FUNCTION 4 ltree_decompress (internal), + FUNCTION 5 _ltree_penalty (internal, internal, internal), + FUNCTION 6 _ltree_picksplit (internal, internal), + FUNCTION 7 _ltree_same (internal, internal, internal), STORAGE ltree_gist; diff --git a/contrib/mysql/my2pg.pl b/contrib/mysql/my2pg.pl index 9ceaca46f55873810f52a0abccfda7fc70bc6d49..737fdd57cd274db1c2e2dd5e1e6d391bff9f010f 100755 --- a/contrib/mysql/my2pg.pl +++ b/contrib/mysql/my2pg.pl @@ -36,7 +36,7 @@ # SUCH DAMAGE. # # $My2pg: my2pg.pl,v 1.24 2001/12/06 19:32:20 fonin Exp $ -# $Id: my2pg.pl,v 1.8 2002/04/24 01:42:29 momjian Exp $ +# $Id: my2pg.pl,v 1.9 2002/08/22 00:01:39 tgl Exp $ # TODO: # + Handle SETs @@ -47,6 +47,12 @@ # # $Log: my2pg.pl,v $ +# Revision 1.9 2002/08/22 00:01:39 tgl +# Add a bunch of pseudo-types to replace the behavior formerly associated +# with OPAQUE, as per recent pghackers discussion. I still want to do some +# more work on the 'cstring' pseudo-type, but I'm going to commit the bulk +# of the changes now before the tree starts shifting under me ... +# # Revision 1.8 2002/04/24 01:42:29 momjian # Update to my2pg 1.24. # @@ -193,7 +199,7 @@ $libtypename.='/libtypes.so'; # push header to libtypes.c open(LIBTYPES,">$libtypesource"); print LIBTYPES "/******************************************************"; -print LIBTYPES "\n * My2Pg \$Revision: 1.8 $ \translated dump"; +print LIBTYPES "\n * My2Pg \$Revision: 1.9 $ \translated dump"; print LIBTYPES "\n * User types definitions"; print LIBTYPES "\n ******************************************************/"; print LIBTYPES "\n\n#include <postgres.h>\n"; @@ -308,11 +314,11 @@ int2* $typename"."_in (char *str) { print LIBTYPES "\n * Types for table ".uc($table_name); print LIBTYPES "\n */\n"; - $types.="\nCREATE FUNCTION $typename"."_in (opaque) + $types.="\nCREATE FUNCTION $typename"."_in (cstring) RETURNS $typename AS '$libtypename' LANGUAGE 'c' - WITH (ISCACHABLE);\n"; + WITH (ISSTRICT, ISCACHABLE);\n"; # creating output function my $func_out=" @@ -362,11 +368,11 @@ bool $typename"."_ge(int2* a, int2* b) { return (*a>=*b); }\n"; - $types.="\nCREATE FUNCTION $typename"."_out (opaque) - RETURNS opaque + $types.="\nCREATE FUNCTION $typename"."_out ($typename) + RETURNS cstring AS '$libtypename' LANGUAGE 'c' - WITH (ISCACHABLE);\n"; + WITH (ISSTRICT, ISCACHABLE);\n"; $types.="\nCREATE TYPE $typename ( internallength = 2, @@ -509,7 +515,7 @@ $typesize* $typename"."_in (char *str) { print LIBTYPES "\n * Types for table ".uc($table_name); print LIBTYPES "\n */\n"; - $types.="\nCREATE FUNCTION $typename"."_in (opaque) + $types.="\nCREATE FUNCTION $typename"."_in (cstring) RETURNS $typename AS '$libtypename' LANGUAGE 'c';\n"; @@ -561,8 +567,8 @@ $typesize find_in_set($typesize *a, $typesize *b) { \n"; - $types.="\nCREATE FUNCTION $typename"."_out (opaque) - RETURNS opaque + $types.="\nCREATE FUNCTION $typename"."_out ($typename) + RETURNS cstring AS '$libtypename' LANGUAGE 'c';\n"; @@ -725,7 +731,7 @@ close(LIBTYPES); open(MAKE,">Makefile"); print MAKE "# -# My2Pg \$Revision: 1.8 $ \translated dump +# My2Pg \$Revision: 1.9 $ \translated dump # Makefile # diff --git a/contrib/noupdate/noup.sql.in b/contrib/noupdate/noup.sql.in index abf92837d1d626ab3b9e0c63abea97c410f289bc..283876258b8a5e2b1647e1f3d5bbd093004511e2 100644 --- a/contrib/noupdate/noup.sql.in +++ b/contrib/noupdate/noup.sql.in @@ -1,6 +1,6 @@ DROP FUNCTION noup (); CREATE FUNCTION noup () - RETURNS opaque + RETURNS trigger AS 'MODULE_PATHNAME' LANGUAGE 'C'; diff --git a/contrib/oracle/Ora2Pg.pm b/contrib/oracle/Ora2Pg.pm index e2dabfc75b8496a676ac4fff4d78f93b4c7af682..a11d8365505bd62e562715ebc91e91ccf923c930 100644 --- a/contrib/oracle/Ora2Pg.pm +++ b/contrib/oracle/Ora2Pg.pm @@ -854,7 +854,7 @@ print STDERR "Add triggers definition...\n" if ($self->{debug}); # Escaping Single Quotes #$trig->[4] =~ s/'/''/sg; - $sql_output .= "CREATE FUNCTION pg_fct_\L$trig->[0]\E () RETURNS OPAQUE AS '\n$trig->[4]\n' LANGUAGE 'plpgsql'\n\n"; + $sql_output .= "CREATE FUNCTION pg_fct_\L$trig->[0]\E () RETURNS TRIGGER AS '\n$trig->[4]\n' LANGUAGE 'plpgsql'\n\n"; $sql_output .= "CREATE TRIGGER \L$trig->[0]\E\n\t$trig->[1] $trig->[2] ON \L$trig->[3]\E FOR EACH ROW\n\tEXECUTE PROCEDURE pg_fct_\L$trig->[0]\E();\n\n"; } } diff --git a/contrib/rserv/MasterInit.in b/contrib/rserv/MasterInit.in index 68854c743a77d7ae4222491b07fdc75822589696..1bfe1c9776e23d2f78d91bbdc369a33e666ebe7a 100644 --- a/contrib/rserv/MasterInit.in +++ b/contrib/rserv/MasterInit.in @@ -89,7 +89,7 @@ RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK); $result = $conn->exec("create sequence _rserv_sync_seq_"); RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK); -$result = $conn->exec("CREATE FUNCTION _rserv_log_() RETURNS opaque" . +$result = $conn->exec("CREATE FUNCTION _rserv_log_() RETURNS trigger" . " AS '@MODULE_FILENAME@' LANGUAGE 'c'"); RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK); diff --git a/contrib/rserv/master.sql.in b/contrib/rserv/master.sql.in index f8d37148b99de9efc95ed8cc922417ab8c119bb3..ed6d2045bc5a75879f91e23b36e3b62f9000626a 100644 --- a/contrib/rserv/master.sql.in +++ b/contrib/rserv/master.sql.in @@ -79,7 +79,7 @@ create sequence _rserv_sync_seq_; drop function _rserv_log_(); CREATE FUNCTION _rserv_log_() - RETURNS opaque + RETURNS trigger AS '@MODULE_FILENAME@' LANGUAGE 'c' ; diff --git a/contrib/rtree_gist/rtree_gist.sql.in b/contrib/rtree_gist/rtree_gist.sql.in index df254404e18f5d540002177cca51d2f2d1b93302..b32671227fa8c07ca211c0b70c8c5a462a72d9df 100644 --- a/contrib/rtree_gist/rtree_gist.sql.in +++ b/contrib/rtree_gist/rtree_gist.sql.in @@ -11,19 +11,19 @@ SET search_path = public; -- -- -- define the GiST support methods -create function gbox_consistent(opaque,box,int4) returns bool as 'MODULE_PATHNAME' language 'C'; +create function gbox_consistent(internal,box,int4) returns bool as 'MODULE_PATHNAME' language 'C'; -create function gbox_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gbox_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C'; -create function rtree_decompress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function rtree_decompress(internal) returns internal as 'MODULE_PATHNAME' language 'C'; -create function gbox_penalty(opaque,opaque,opaque) returns opaque as 'MODULE_PATHNAME' language 'C' with (isstrict); +create function gbox_penalty(internal,internal,internal) returns internal as 'MODULE_PATHNAME' language 'C' with (isstrict); -create function gbox_picksplit(opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gbox_picksplit(internal, internal) returns internal as 'MODULE_PATHNAME' language 'C'; -create function gbox_union(bytea, opaque) returns box as 'MODULE_PATHNAME' language 'C'; +create function gbox_union(bytea, internal) returns box as 'MODULE_PATHNAME' language 'C'; -create function gbox_same(box, box, opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gbox_same(box, box, internal) returns internal as 'MODULE_PATHNAME' language 'C'; -- create the operator class CREATE OPERATOR CLASS gist_box_ops @@ -36,13 +36,13 @@ CREATE OPERATOR CLASS gist_box_ops OPERATOR 6 ~= , OPERATOR 7 ~ , OPERATOR 8 @ , - FUNCTION 1 gbox_consistent (opaque, box, int4), - FUNCTION 2 gbox_union (bytea, opaque), - FUNCTION 3 gbox_compress (opaque), - FUNCTION 4 rtree_decompress (opaque), - FUNCTION 5 gbox_penalty (opaque, opaque, opaque), - FUNCTION 6 gbox_picksplit (opaque, opaque), - FUNCTION 7 gbox_same (box, box, opaque); + FUNCTION 1 gbox_consistent (internal, box, int4), + FUNCTION 2 gbox_union (bytea, internal), + FUNCTION 3 gbox_compress (internal), + FUNCTION 4 rtree_decompress (internal), + FUNCTION 5 gbox_penalty (internal, internal, internal), + FUNCTION 6 gbox_picksplit (internal, internal), + FUNCTION 7 gbox_same (box, box, internal); -- @@ -53,9 +53,9 @@ CREATE OPERATOR CLASS gist_box_ops -- -- -- define the GiST support methods -create function gpoly_consistent(opaque,polygon,int4) returns bool as 'MODULE_PATHNAME' language 'C'; +create function gpoly_consistent(internal,polygon,int4) returns bool as 'MODULE_PATHNAME' language 'C'; -create function gpoly_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C'; +create function gpoly_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C'; -- create the operator class CREATE OPERATOR CLASS gist_poly_ops @@ -68,13 +68,13 @@ CREATE OPERATOR CLASS gist_poly_ops OPERATOR 6 ~= RECHECK , OPERATOR 7 ~ RECHECK , OPERATOR 8 @ RECHECK , - FUNCTION 1 gpoly_consistent (opaque, polygon, int4), - FUNCTION 2 gbox_union (bytea, opaque), - FUNCTION 3 gpoly_compress (opaque), - FUNCTION 4 rtree_decompress (opaque), - FUNCTION 5 gbox_penalty (opaque, opaque, opaque), - FUNCTION 6 gbox_picksplit (opaque, opaque), - FUNCTION 7 gbox_same (box, box, opaque), + FUNCTION 1 gpoly_consistent (internal, polygon, int4), + FUNCTION 2 gbox_union (bytea, internal), + FUNCTION 3 gpoly_compress (internal), + FUNCTION 4 rtree_decompress (internal), + FUNCTION 5 gbox_penalty (internal, internal, internal), + FUNCTION 6 gbox_picksplit (internal, internal), + FUNCTION 7 gbox_same (box, box, internal), STORAGE box; diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index 097304b63859a04a40dd428a769f1494e62f502c..d7eea9cadd73d3bf46c809d6c606b22265b6e00f 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -114,14 +114,6 @@ seg_in(char *str) return (result); } -/* - * You might have noticed a slight inconsistency between the following - * declaration and the SQL definition: - * CREATE FUNCTION seg_out(opaque) RETURNS opaque ... - * The reason is that the argument passed into seg_out is really just a - * pointer. POSTGRES thinks all output functions are: - * char *out_func(char *); - */ char * seg_out(SEG * seg) { diff --git a/contrib/seg/seg.sql.in b/contrib/seg/seg.sql.in index 2da70ac682b272718c60a12533eb1b9fe71a774a..cbeaa08d137a42df0bb8714d7dd648be0ca0467b 100644 --- a/contrib/seg/seg.sql.in +++ b/contrib/seg/seg.sql.in @@ -5,13 +5,13 @@ BEGIN TRANSACTION; -- Adjust this setting to control where the objects get created. SET search_path = public; -CREATE FUNCTION seg_in(opaque) -RETURNS opaque +CREATE FUNCTION seg_in(cstring) +RETURNS seg AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION seg_out(opaque) -RETURNS opaque +CREATE FUNCTION seg_out(seg) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c'; @@ -216,25 +216,25 @@ CREATE OPERATOR ~ ( -- define the GiST support methods -CREATE FUNCTION gseg_consistent(opaque,seg,int4) RETURNS bool +CREATE FUNCTION gseg_consistent(internal,seg,int4) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gseg_compress(opaque) RETURNS opaque +CREATE FUNCTION gseg_compress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gseg_decompress(opaque) RETURNS opaque +CREATE FUNCTION gseg_decompress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gseg_penalty(opaque,opaque,opaque) RETURNS opaque +CREATE FUNCTION gseg_penalty(internal,internal,internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION gseg_picksplit(opaque, opaque) RETURNS opaque +CREATE FUNCTION gseg_picksplit(internal, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gseg_union(bytea, opaque) RETURNS seg +CREATE FUNCTION gseg_union(bytea, internal) RETURNS seg AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gseg_same(seg, seg, opaque) RETURNS opaque +CREATE FUNCTION gseg_same(seg, seg, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; @@ -250,13 +250,13 @@ CREATE OPERATOR CLASS gist_seg_ops OPERATOR 6 = , OPERATOR 7 @ , OPERATOR 8 ~ , - FUNCTION 1 gseg_consistent (opaque, seg, int4), - FUNCTION 2 gseg_union (bytea, opaque), - FUNCTION 3 gseg_compress (opaque), - FUNCTION 4 gseg_decompress (opaque), - FUNCTION 5 gseg_penalty (opaque, opaque, opaque), - FUNCTION 6 gseg_picksplit (opaque, opaque), - FUNCTION 7 gseg_same (seg, seg, opaque); + FUNCTION 1 gseg_consistent (internal, seg, int4), + FUNCTION 2 gseg_union (bytea, internal), + FUNCTION 3 gseg_compress (internal), + FUNCTION 4 gseg_decompress (internal), + FUNCTION 5 gseg_penalty (internal, internal, internal), + FUNCTION 6 gseg_picksplit (internal, internal), + FUNCTION 7 gseg_same (seg, seg, internal); END TRANSACTION; diff --git a/contrib/spi/autoinc.sql.in b/contrib/spi/autoinc.sql.in index 367674294352dc28fedce86ff9b6490a45558764..172fdd74b251fb4a36eac2847cae348d32b61b6a 100644 --- a/contrib/spi/autoinc.sql.in +++ b/contrib/spi/autoinc.sql.in @@ -1,6 +1,6 @@ DROP FUNCTION autoinc(); CREATE FUNCTION autoinc() - RETURNS opaque + RETURNS trigger AS 'MODULE_PATHNAME' LANGUAGE 'C'; diff --git a/contrib/spi/insert_username.sql.in b/contrib/spi/insert_username.sql.in index 436fc88b73cdbe23da6899aa10da43a69a681e79..b7689a4321c52bd5e29165e957a240a18f337e41 100644 --- a/contrib/spi/insert_username.sql.in +++ b/contrib/spi/insert_username.sql.in @@ -1,6 +1,6 @@ DROP FUNCTION insert_username(); CREATE FUNCTION insert_username() - RETURNS opaque + RETURNS trigger AS 'MODULE_PATHNAME' LANGUAGE 'C'; diff --git a/contrib/spi/moddatetime.sql.in b/contrib/spi/moddatetime.sql.in index d497900ecf19431fc5719307325d74f75121df0b..07208787a66297466ad5b72fc62452989124c85f 100644 --- a/contrib/spi/moddatetime.sql.in +++ b/contrib/spi/moddatetime.sql.in @@ -1,6 +1,6 @@ DROP FUNCTION moddatetime(); CREATE FUNCTION moddatetime() - RETURNS opaque + RETURNS trigger AS 'MODULE_PATHNAME' LANGUAGE 'C'; diff --git a/contrib/spi/refint.sql.in b/contrib/spi/refint.sql.in index d193319d9d4bfaf37341feeb0704227a28eec61d..688d2abd447c4b9ff33db5ab9b6ed3f224f10f77 100644 --- a/contrib/spi/refint.sql.in +++ b/contrib/spi/refint.sql.in @@ -2,11 +2,11 @@ DROP FUNCTION check_primary_key (); DROP FUNCTION check_foreign_key (); CREATE FUNCTION check_primary_key () - RETURNS opaque + RETURNS trigger AS 'MODULE_PATHNAME' LANGUAGE 'C'; CREATE FUNCTION check_foreign_key () - RETURNS opaque + RETURNS trigger AS 'MODULE_PATHNAME' LANGUAGE 'C'; diff --git a/contrib/spi/timetravel.sql.in b/contrib/spi/timetravel.sql.in index 46912abf6d78588fd2237290c6eee0d2810bcf8d..f519b93de1fb097dcf9ee82ececbec9ab610f767 100644 --- a/contrib/spi/timetravel.sql.in +++ b/contrib/spi/timetravel.sql.in @@ -2,7 +2,7 @@ DROP FUNCTION timetravel(); DROP FUNCTION set_timetravel(name, int4); CREATE FUNCTION timetravel() - RETURNS opaque + RETURNS trigger AS 'MODULE_PATHNAME' LANGUAGE 'C'; diff --git a/contrib/string/string_io.sql.in b/contrib/string/string_io.sql.in index 2a15e4b53541d171ab195d5d2c55b0befa15af14..8718b812bb20189141198697ad26473e2762750a 100644 --- a/contrib/string/string_io.sql.in +++ b/contrib/string/string_io.sql.in @@ -9,21 +9,21 @@ -- Define the new output functions. -- -create function c_charout(opaque) returns int4 +create function c_charout(bpchar) returns cstring as 'MODULE_PATHNAME' language 'c'; -create function c_textout(opaque) returns int4 +create function c_textout(text) returns cstring as 'MODULE_PATHNAME' language 'c'; -create function c_varcharout(opaque) returns int4 +create function c_varcharout(varchar) returns cstring as 'MODULE_PATHNAME' language 'c'; -- This is not needed because escapes are handled by the parser -- --- create function c_textin(opaque) +-- create function c_textin(cstring) -- returns text -- as 'MODULE_PATHNAME' -- language 'c'; diff --git a/contrib/tsearch/tsearch.sql.in b/contrib/tsearch/tsearch.sql.in index 356427f2a4628402e31d38045f6297caa9f63ec8..a709a14758e70d53a053efdc93da68b28f6e9652 100644 --- a/contrib/tsearch/tsearch.sql.in +++ b/contrib/tsearch/tsearch.sql.in @@ -5,13 +5,13 @@ SET search_path = public; -- TXTIDX type -CREATE FUNCTION txtidx_in(opaque) -RETURNS opaque +CREATE FUNCTION txtidx_in(cstring) +RETURNS txtidx AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION txtidx_out(opaque) -RETURNS opaque +CREATE FUNCTION txtidx_out(txtidx) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -34,13 +34,13 @@ LANGUAGE 'c' with (isstrict); --QUERYTYPES --without morphology -CREATE FUNCTION qtxt_in(opaque) -RETURNS opaque +CREATE FUNCTION qtxt_in(cstring) +RETURNS query_txt AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION qtxt_out(opaque) -RETURNS opaque +CREATE FUNCTION qtxt_out(query_txt) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -51,15 +51,21 @@ output = qtxt_out ); --with morphology -CREATE FUNCTION mqtxt_in(opaque) -RETURNS opaque +CREATE FUNCTION mqtxt_in(cstring) +RETURNS mquery_txt AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); +--same C output function as for query_txt +CREATE FUNCTION mqtxt_out(mquery_txt) +RETURNS cstring +AS 'MODULE_PATHNAME', 'qtxt_out' +LANGUAGE 'c' with (isstrict); + CREATE TYPE mquery_txt ( internallength = -1, input = mqtxt_in, -output = qtxt_out +output = mqtxt_out ); --only for debug @@ -115,19 +121,19 @@ CREATE OPERATOR ~# ( ); --Trigger -create function tsearch() returns opaque as +create function tsearch() returns trigger as 'MODULE_PATHNAME' language 'C'; --GiST --GiST key type -CREATE FUNCTION gtxtidx_in(opaque) -RETURNS opaque +CREATE FUNCTION gtxtidx_in(cstring) +RETURNS gtxtidx AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION gtxtidx_out(opaque) -RETURNS opaque +CREATE FUNCTION gtxtidx_out(gtxtidx) +RETURNS cstring AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); @@ -138,25 +144,25 @@ output = gtxtidx_out ); -- support functions -CREATE FUNCTION gtxtidx_consistent(gtxtidx,opaque,int4) RETURNS bool +CREATE FUNCTION gtxtidx_consistent(gtxtidx,internal,int4) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gtxtidx_compress(opaque) RETURNS opaque +CREATE FUNCTION gtxtidx_compress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gtxtidx_decompress(opaque) RETURNS opaque +CREATE FUNCTION gtxtidx_decompress(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gtxtidx_penalty(opaque,opaque,opaque) RETURNS opaque +CREATE FUNCTION gtxtidx_penalty(internal,internal,internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict); -CREATE FUNCTION gtxtidx_picksplit(opaque, opaque) RETURNS opaque +CREATE FUNCTION gtxtidx_picksplit(internal, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gtxtidx_union(bytea, opaque) RETURNS _int4 +CREATE FUNCTION gtxtidx_union(bytea, internal) RETURNS _int4 AS 'MODULE_PATHNAME' LANGUAGE 'c'; -CREATE FUNCTION gtxtidx_same(gtxtidx, gtxtidx, opaque) RETURNS opaque +CREATE FUNCTION gtxtidx_same(gtxtidx, gtxtidx, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE 'c'; -- create the operator class @@ -164,13 +170,13 @@ CREATE OPERATOR CLASS gist_txtidx_ops DEFAULT FOR TYPE txtidx USING gist AS OPERATOR 1 @@ (txtidx, query_txt) RECHECK , OPERATOR 2 ## (txtidx, mquery_txt) RECHECK , - FUNCTION 1 gtxtidx_consistent (gtxtidx, opaque, int4), - FUNCTION 2 gtxtidx_union (bytea, opaque), - FUNCTION 3 gtxtidx_compress (opaque), - FUNCTION 4 gtxtidx_decompress (opaque), - FUNCTION 5 gtxtidx_penalty (opaque, opaque, opaque), - FUNCTION 6 gtxtidx_picksplit (opaque, opaque), - FUNCTION 7 gtxtidx_same (gtxtidx, gtxtidx, opaque), + FUNCTION 1 gtxtidx_consistent (gtxtidx, internal, int4), + FUNCTION 2 gtxtidx_union (bytea, internal), + FUNCTION 3 gtxtidx_compress (internal), + FUNCTION 4 gtxtidx_decompress (internal), + FUNCTION 5 gtxtidx_penalty (internal, internal, internal), + FUNCTION 6 gtxtidx_picksplit (internal, internal), + FUNCTION 7 gtxtidx_same (gtxtidx, gtxtidx, internal), STORAGE gtxtidx; diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index aa4e25ccb60cb86c2ec6c434495702e879ef3235..cbb92274e12d15afc4e3fb512c4b44d20fd7e766 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.99 2002/08/19 19:33:33 tgl Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.100 2002/08/22 00:01:40 tgl Exp $ --> <chapter id="datatype"> @@ -3099,6 +3099,146 @@ SELECT SUBSTRING(b FROM 1 FOR 2) FROM test; </sect1> + <sect1 id="datatype-pseudo"> + <title>Pseudo-Types</title> + + <indexterm zone="datatype-pseudo"> + <primary>record</primary> + </indexterm> + + <indexterm zone="datatype-pseudo"> + <primary>any</primary> + </indexterm> + + <indexterm zone="datatype-pseudo"> + <primary>anyarray</primary> + </indexterm> + + <indexterm zone="datatype-pseudo"> + <primary>void</primary> + </indexterm> + + <indexterm zone="datatype-pseudo"> + <primary>trigger</primary> + </indexterm> + + <indexterm zone="datatype-pseudo"> + <primary>language_handler</primary> + </indexterm> + + <indexterm zone="datatype-pseudo"> + <primary>cstring</primary> + </indexterm> + + <indexterm zone="datatype-pseudo"> + <primary>internal</primary> + </indexterm> + + <indexterm zone="datatype-pseudo"> + <primary>opaque</primary> + </indexterm> + + <para> + The <productname>PostgreSQL</productname> type system contains a number + of special-purpose entries that are collectively called + <firstterm>pseudo-types</>. A pseudo-type cannot be used as a column + datatype, but it can be used to declare a function's argument or result + type. Each of the available pseudo-types is useful in situations where + a function's behavior does not correspond to simply taking or returning + a value of a specific SQL datatype. + </para> + + <para> + <table tocentry="1"> + <title>Pseudo-Types</title> + <tgroup cols="2"> + <thead> + <row> + <entry>Type name</entry> + <entry>Description</entry> + </row> + </thead> + + <tbody> + + <row> + <entry><type>record</></entry> + <entry>Identifies a function returning an unspecified tuple type</entry> + </row> + + <row> + <entry><type>any</></entry> + <entry>Indicates that a function accepts any input datatype whatever</entry> + </row> + + <row> + <entry><type>anyarray</></entry> + <entry>Indicates that a function accepts any array datatype</entry> + </row> + + <row> + <entry><type>void</></entry> + <entry>Indicates that a function returns no value</entry> + </row> + + <row> + <entry><type>trigger</></entry> + <entry>A trigger function is declared to return <type>trigger</></entry> + </row> + + <row> + <entry><type>language_handler</></entry> + <entry>A procedural language call handler is declared to return <type>language_handler</></entry> + </row> + + <row> + <entry><type>cstring</></entry> + <entry>Indicates a function takes or returns a null-terminated C string</entry> + </row> + + <row> + <entry><type>internal</></entry> + <entry>Indicates that a function accepts or returns a server-internal + data type</entry> + </row> + + <row> + <entry><type>opaque</></entry> + <entry>An obsolete type name that formerly served all the above purposes</entry> + </row> + </tbody> + </tgroup> + </table> + </para> + + <para> + Functions coded in C (whether built-in or dynamically loaded) may be + declared to take or return any of these pseudo datatypes. It is up to + the function author to ensure that the function will behave safely + when a pseudo-type is used as an argument type. + </para> + + <para> + Functions coded in procedural languages may use pseudo-types only as + allowed by their implementation languages. At present the procedural + languages all forbid use of a pseudo-type as argument type, and allow + only <type>void</> as a result type (plus <type>trigger</> when the + function is used as a trigger). + </para> + + <para> + The <type>internal</> pseudo-type is used to declare functions that are + meant only to be called internally by the database system, and not by + direct invocation in a SQL query. If a function has at least one + <type>internal</>-type argument then it cannot be called from SQL. + To preserve the type safety of this restriction it is important to + follow this coding rule: do not create any function that is declared + to return <type>internal</> unless it has at least one <type>internal</> + argument. + </para> + + </sect1> + &array; </chapter> diff --git a/doc/src/sgml/indexcost.sgml b/doc/src/sgml/indexcost.sgml index c30be63166c921e3fab571b807e5bdf685f50cb2..63cf8daf22deac9f2a0af094b1f6c65b35621827 100644 --- a/doc/src/sgml/indexcost.sgml +++ b/doc/src/sgml/indexcost.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/Attic/indexcost.sgml,v 2.11 2002/03/22 19:20:10 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/Attic/indexcost.sgml,v 2.12 2002/08/22 00:01:40 tgl Exp $ --> <chapter id="indexcost"> @@ -261,15 +261,8 @@ amcostestimate (Query *root, <para> By convention, the <literal>pg_proc</literal> entry for an <literal>amcostestimate</literal> function should show - - <programlisting> -prorettype = 0 -pronargs = 8 -proargtypes = 0 0 0 0 0 0 0 0 - </programlisting> - - We use zero ("opaque") for all the arguments since none of them have types - that are known in pg_type. + eight arguments all declared as <type>internal</> (since none of them have + types that are known to SQL), and the return type is <type>void</>. </para> </chapter> diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 3e90f32665d70dfd3f40da3d87c6047e63151e80..51b85b9d85ccd27acb5435cfedf376b35f987d80 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.2 2002/08/20 05:28:23 momjian Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.3 2002/08/22 00:01:40 tgl Exp $ --> <chapter id="plpgsql"> @@ -1865,7 +1865,7 @@ RAISE EXCEPTION ''Inexistent ID --> %'',user_id; <application>PL/pgSQL</application> can be used to define trigger procedures. A trigger procedure is created with the <command>CREATE FUNCTION</command> command as a function with no arguments and a return - type of <type>OPAQUE</type>. Note that the function must be declared + type of <type>TRIGGER</type>. Note that the function must be declared with no arguments even if it expects to receive arguments specified in <command>CREATE TRIGGER</> --- trigger arguments are passed via <varname>TG_ARGV</>, as described below. @@ -2022,7 +2022,7 @@ CREATE TABLE emp ( last_user text ); -CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS ' +CREATE FUNCTION emp_stamp () RETURNS TRIGGER AS ' BEGIN -- Check that empname and salary are given IF NEW.empname ISNULL THEN diff --git a/doc/src/sgml/pltcl.sgml b/doc/src/sgml/pltcl.sgml index a6109b0195da7df4b2303a76dda74055dbaa561c..a81e5ce52e96839e826c304905423cdf41585e9f 100644 --- a/doc/src/sgml/pltcl.sgml +++ b/doc/src/sgml/pltcl.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.20 2002/03/22 19:20:21 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.21 2002/08/22 00:01:40 tgl Exp $ --> <chapter id="pltcl"> @@ -472,7 +472,7 @@ SELECT 'doesn''t' AS ret Trigger procedures can be written in PL/Tcl. As is customary in <productname>PostgreSQL</productname>, a procedure that's to be called as a trigger must be declared as a function with no arguments - and a return type of <literal>opaque</>. + and a return type of <literal>trigger</>. </para> <para> The information from the trigger manager is passed to the procedure body @@ -597,7 +597,7 @@ SELECT 'doesn''t' AS ret incremented on every update operation: <programlisting> -CREATE FUNCTION trigfunc_modcount() RETURNS OPAQUE AS ' +CREATE FUNCTION trigfunc_modcount() RETURNS TRIGGER AS ' switch $TG_op { INSERT { set NEW($1) 0 diff --git a/doc/src/sgml/ref/create_conversion.sgml b/doc/src/sgml/ref/create_conversion.sgml index ce18528d4957e0cc45da679d6e0635069154e363..ce45c2d4d43c92376b441f044bb898756440da2c 100644 --- a/doc/src/sgml/ref/create_conversion.sgml +++ b/doc/src/sgml/ref/create_conversion.sgml @@ -1,4 +1,4 @@ -<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_conversion.sgml,v 1.2 2002/07/22 13:00:00 ishii Exp $ --> +<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_conversion.sgml,v 1.3 2002/08/22 00:01:40 tgl Exp $ --> <refentry id="SQL-CREATECONVERSION"> <refmeta> @@ -108,10 +108,10 @@ CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable> conv_proc( INTEGER, -- source encoding id INTEGER, -- destination encoding id - OPAQUE, -- source string (null terminated C string) - OPAQUE, -- destination string (null terminated C string) + CSTRING, -- source string (null terminated C string) + CSTRING, -- destination string (null terminated C string) INTEGER -- source string length - ) returns INTEGER; -- dummy. returns nothing, actually. + ) returns VOID; </programlisting> </para> </listitem> diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index 2c618140c8514ba6931542afe85f392cb24b5e72..105a4a16103415b613c49c85b6a5a61d8bf8c683 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.41 2002/07/24 19:11:07 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.42 2002/08/22 00:01:40 tgl Exp $ --> <refentry id="SQL-CREATEFUNCTION"> @@ -67,16 +67,17 @@ CREATE [ OR REPLACE ] FUNCTION <replaceable class="parameter">name</replaceable> <listitem> <para> The data type(s) of the function's arguments, if any. The - input types may be base or complex types, - <literal>opaque</literal>, or the same as the type of an - existing column. <literal>Opaque</literal> indicates - that the function accepts arguments of a non-SQL type such as - <type>char *</type>. - The type of a column is indicated using <replaceable + input types may be base, complex, or domain types, + or the same as the type of an existing column. + The type of a column is referenced by writing <replaceable class="parameter">tablename</replaceable>.<replaceable class="parameter">columnname</replaceable><literal>%TYPE</literal>; using this can sometimes help make a function independent from changes to the definition of a table. + Depending on the implementation language it may also be allowed + to specify <quote>pseudo-types</> such as <type>cstring</>. + Pseudo-types indicate that the actual argument type is either + incompletely specified, or outside the set of ordinary SQL datatypes. </para> </listitem> </varlistentry> @@ -87,15 +88,13 @@ CREATE [ OR REPLACE ] FUNCTION <replaceable class="parameter">name</replaceable> <listitem> <para> The return data type. The return type may be specified as a - base type, complex type, <literal>setof</literal> type, - <literal>opaque</literal>, or the same as the type of an + base, complex, or domain type, or the same as the type of an existing column. + Depending on the implementation language it may also be allowed + to specify <quote>pseudo-types</> such as <type>cstring</>. The <literal>setof</literal> modifier indicates that the function will return a set of - items, rather than a single item. Functions with a declared - return type of <literal>opaque</literal> do not return a value. - These cannot be called directly; trigger functions make use of - this feature. + items, rather than a single item. </para> </listitem> </varlistentry> diff --git a/doc/src/sgml/ref/create_language.sgml b/doc/src/sgml/ref/create_language.sgml index 1431c32fc5aa41b08c317999bda3b98a0a454f5d..5cdf5dc9345a91274ecc60394906e367df0bb9f5 100644 --- a/doc/src/sgml/ref/create_language.sgml +++ b/doc/src/sgml/ref/create_language.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.26 2002/07/24 19:11:07 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.27 2002/08/22 00:01:40 tgl Exp $ PostgreSQL documentation --> @@ -108,8 +108,8 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langna language such as C with version 1 call convention and registered with <productname>PostgreSQL</productname> as a function taking no arguments and returning the - <type>opaque</type> type, a placeholder for unspecified or - undefined types. + <type>language_handler</type> type, a placeholder type that is + simply used to identify the function as a call handler. </para> </listitem> </varlistentry> @@ -122,11 +122,13 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langna <replaceable class="parameter">valfunction</replaceable> is the name of a previously registered function that will be called when a new function in the language is created, to validate the - new function. The validator function must take one argument of - type <type>oid</type>, which will be the OID of the - to-be-created function, and can have any return type. If no + new function. + If no validator function is specified, then a new function will not be checked when it is created. + The validator function must take one argument of + type <type>oid</type>, which will be the OID of the + to-be-created function, and will typically return <type>void</>. </para> <para> @@ -251,7 +253,7 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable The following two commands executed in sequence will register a new procedural language and the associated call handler. <programlisting> -CREATE FUNCTION plsample_call_handler () RETURNS opaque +CREATE FUNCTION plsample_call_handler () RETURNS language_handler AS '$libdir/plsample' LANGUAGE C; CREATE LANGUAGE plsample diff --git a/doc/src/sgml/ref/create_opclass.sgml b/doc/src/sgml/ref/create_opclass.sgml index 6d00f081f816ac71e26cd1954d62022e2df1e772..6c5c0fdb1940cd6260992ecfcad6ee8e0d484a44 100644 --- a/doc/src/sgml/ref/create_opclass.sgml +++ b/doc/src/sgml/ref/create_opclass.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_opclass.sgml,v 1.1 2002/07/29 22:14:10 tgl Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_opclass.sgml,v 1.2 2002/08/22 00:01:40 tgl Exp $ PostgreSQL documentation --> @@ -260,13 +260,13 @@ CREATE OPERATOR CLASS gist__int_ops OPERATOR 7 @, OPERATOR 8 ~, OPERATOR 20 @@ (_int4, query_int), - FUNCTION 1 g_int_consistent (opaque, _int4, int4), - FUNCTION 2 g_int_union (bytea, opaque), - FUNCTION 3 g_int_compress (opaque), - FUNCTION 4 g_int_decompress (opaque), - FUNCTION 5 g_int_penalty (opaque, opaque, opaque), - FUNCTION 6 g_int_picksplit (opaque, opaque), - FUNCTION 7 g_int_same (_int4, _int4, opaque); + FUNCTION 1 g_int_consistent (internal, _int4, int4), + FUNCTION 2 g_int_union (bytea, internal), + FUNCTION 3 g_int_compress (internal), + FUNCTION 4 g_int_decompress (internal), + FUNCTION 5 g_int_penalty (internal, internal, internal), + FUNCTION 6 g_int_picksplit (internal, internal), + FUNCTION 7 g_int_same (_int4, _int4, internal); </programlisting> <para> diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml index e9f66d95b48f6c9160def8bf575d16c0c681f7e3..c736dd95df90114d3e1106a86ecec9687af38a8b 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.26 2002/05/18 15:44:47 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.27 2002/08/22 00:01:40 tgl Exp $ PostgreSQL documentation --> @@ -66,7 +66,7 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE <listitem> <para> A user-supplied function that is declared as taking no arguments - and returning type <literal>opaque</>. + and returning type <literal>trigger</>. </para> </listitem> </varlistentry> @@ -167,6 +167,14 @@ CREATE TRIGGER <literal>TRIGGER</literal> privilege on the table. </para> + <para> + In <productname>PostgreSQL</productname> versions before 7.3, it was + necessary to declare trigger functions as returning the placeholder + type <type>opaque</>, rather than <type>trigger</>. This is still + supported, but is deprecated because it is obscure and causes loss of + type safety. + </para> + <para> As of the current release, <literal>STATEMENT</literal> triggers are not implemented. </para> diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index 9da93a42d289ac0e52a05e4c945566d65126f953..feb69916e09c634d6212407b936d14cbd1453062 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.31 2002/08/15 16:36:00 momjian Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.32 2002/08/22 00:01:40 tgl Exp $ PostgreSQL documentation --> @@ -226,22 +226,47 @@ CREATE TYPE operators and functions defined for the type. Naturally, <replaceable class="parameter">output_function</replaceable> performs the reverse transformation. The input function may be - declared as taking one argument of type <type>opaque</type>, + declared as taking one argument of type <type>cstring</type>, or as taking three arguments of types - <type>opaque</type>, <type>OID</type>, <type>int4</type>. + <type>cstring</type>, <type>OID</type>, <type>int4</type>. (The first argument is the input text as a C string, the second argument is the element type in case this is an array type, and the third is the typmod of the destination column, if known.) + It should return a value of the datatype itself. The output function may be - declared as taking one argument of type <type>opaque</type>, - or as taking two arguments of types - <type>opaque</type>, <type>OID</type>. - (The first argument is actually of the data type itself, but since the - output function must be declared first, it's easier to declare it as - accepting type <type>opaque</type>. The second argument is again - the array element type for array types.) + declared as taking one argument of the new datatype, or as taking + two arguments of which the second is type <type>OID</type>. + (The second argument is again the array element type for array types.) + The output function should return type <type>cstring</type>. </para> + <para> + You should at this point be wondering how the input and output functions + can be declared to have results or inputs of the new type, when they have + to be created before the new type can be created. The answer is that the + input function must be created first, then the output function, then the + datatype. + <productname>PostgreSQL</productname> will first see the name of the new + datatype as the return type of the input function. It will create a + <quote>shell</> type, which is simply a placeholder entry in + <literal>pg_type</>, and link the input function definition to the shell + type. Similarly the output function will be linked to the (now already + existing) shell type. Finally, <command>CREATE TYPE</> replaces the + shell entry with a complete type definition, and the new type can be used. + </para> + + <note> + <para> + In <productname>PostgreSQL</productname> versions before 7.3, it was + customary to avoid creating a shell type by replacing the functions' + forward references to the type name with the placeholder pseudo-type + <type>OPAQUE</>. The <type>cstring</> inputs and + results also had to be declared as <type>OPAQUE</> before 7.3. + Use of <type>OPAQUE</> for this purpose is still supported, but it is + deprecated because it causes loss of type safety. + </para> + </note> + <para> New base data types can be fixed length, in which case <replaceable class="parameter">internallength</replaceable> is a diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index b11a78b6ef69e9828dced2da837ec62e608e762d..208a66d670754514d1dac1446a68343b9f5360db 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.149 2002/08/20 17:54:44 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.150 2002/08/22 00:01:40 tgl Exp $ --> <appendix id="release"> @@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without worries about funny characters. --> <literallayout><![CDATA[ +Type OPAQUE is now deprecated in favor of pseudo-types cstring, trigger, etc Files larger than 2 GB are now supported (if supported by the operating system) SERIAL no longer implies UNIQUE; specify explicitly if index is wanted pg_dump -n and -N options have been removed. The new behavior is like -n but knows about key words. diff --git a/doc/src/sgml/trigger.sgml b/doc/src/sgml/trigger.sgml index 5456f4d0cdb43d0c4b86408ff9a5c75cb56fc348..f94c2b7d8a7870d1a04cc2e5a3116424738594cf 100644 --- a/doc/src/sgml/trigger.sgml +++ b/doc/src/sgml/trigger.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.23 2002/04/19 16:36:08 tgl Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.24 2002/08/22 00:01:40 tgl Exp $ --> <chapter id="triggers"> @@ -26,7 +26,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.23 2002/04/19 16:36:08 tgl <para> The trigger function must be defined before the trigger itself can be created. The trigger function must be declared as a - function taking no arguments and returning type <literal>opaque</>. + function taking no arguments and returning type <literal>trigger</>. (The trigger function receives its input through a TriggerData structure, not in the form of ordinary function arguments.) If the function is written in C, it must use the <quote>version 1</> @@ -536,7 +536,7 @@ trigf(PG_FUNCTION_ARGS) Now, compile and create the trigger function: <programlisting> -CREATE FUNCTION trigf () RETURNS OPAQUE AS +CREATE FUNCTION trigf () RETURNS TRIGGER AS '...path_to_so' LANGUAGE 'C'; CREATE TABLE ttest (x int4); diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 91d1849d529bf8ff6df20859a3e70d6ee8a4fa55..9b7c42d251f7417fca616ca078085a23ebbf974b 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.54 2002/07/30 16:20:03 momjian Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.55 2002/08/22 00:01:40 tgl Exp $ --> <chapter id="xfunc"> @@ -2071,12 +2071,9 @@ SELECT * FROM vw_getfoo; <quote>normal</quote> function, which must be written in a compiled language such as C and registered with <productname>PostgreSQL</productname> as taking no arguments and - returning the <type>opaque</type> type, a placeholder for - unspecified or undefined types. This prevents the call handler - from being called directly as a function from queries. (However, - arguments may be supplied in the actual call to the handler when a - function in the language offered by the handler is to be - executed.) + returning the <type>language_handler</type> type. + This special pseudo-type identifies the handler as a call handler + and prevents it from being called directly in queries. </para> <note> @@ -2203,7 +2200,7 @@ plsample_call_handler(PG_FUNCTION_ARGS) The following commands then register the sample procedural language: <programlisting> -CREATE FUNCTION plsample_call_handler () RETURNS opaque +CREATE FUNCTION plsample_call_handler () RETURNS language_handler AS '/usr/local/pgsql/lib/plsample' LANGUAGE C; CREATE LANGUAGE plsample diff --git a/doc/src/sgml/xplang.sgml b/doc/src/sgml/xplang.sgml index 9accf8daa768ea13345412b4a8d20c20496003ea..34bdcf664f87dc8ac08e0ac0e4b6658341578bdc 100644 --- a/doc/src/sgml/xplang.sgml +++ b/doc/src/sgml/xplang.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.17 2002/01/07 02:29:14 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.18 2002/08/22 00:01:40 tgl Exp $ --> <chapter id="xplang"> @@ -82,10 +82,10 @@ createlang plpgsql template1 The handler must be declared with the command <synopsis> CREATE FUNCTION <replaceable>handler_function_name</replaceable> () - RETURNS OPAQUE AS + RETURNS LANGUAGE_HANDLER AS '<replaceable>path-to-shared-object</replaceable>' LANGUAGE C; </synopsis> - The special return type of <type>OPAQUE</type> tells + The special return type of <type>LANGUAGE_HANDLER</type> tells the database that this function does not return one of the defined <acronym>SQL</acronym> data types and is not directly usable in <acronym>SQL</acronym> statements. @@ -140,7 +140,7 @@ CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <re shared object for the <application>PL/pgSQL</application> language's call handler function. <programlisting> -CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS +CREATE FUNCTION plpgsql_call_handler () RETURNS LANGUAGE_HANDLER AS '$libdir/plpgsql' LANGUAGE C; </programlisting> </para> diff --git a/doc/src/sgml/xtypes.sgml b/doc/src/sgml/xtypes.sgml index 9886e7a3c33ae7b5f9933e9037fcd98e6bef6fb9..8242aee8c498b23a8602b82fde106405e0dd815c 100644 --- a/doc/src/sgml/xtypes.sgml +++ b/doc/src/sgml/xtypes.sgml @@ -128,13 +128,13 @@ complex_out(Complex *complex) <function>complex_out</function> before creating the type: <programlisting> -CREATE FUNCTION complex_in(opaque) +CREATE FUNCTION complex_in(cstring) RETURNS complex AS '<replaceable>PGROOT</replaceable>/tutorial/complex' LANGUAGE C; -CREATE FUNCTION complex_out(opaque) - RETURNS opaque +CREATE FUNCTION complex_out(complex) + RETURNS cstring AS '<replaceable>PGROOT</replaceable>/tutorial/complex' LANGUAGE C; </programlisting> @@ -149,6 +149,10 @@ CREATE TYPE complex ( output = complex_out ); </programlisting> + + Notice that the declarations of the input and output functions must + reference the not-yet-defined type. This is allowed, but will draw + warning messages that may be ignored. </para> <para> diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index a8a8f0da2f1cc257f8c2c36bc293a6c646fbd92c..6fbce87be7cab41dcb0fe1076f35b7e5a1cbb921 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -9,7 +9,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.62 2002/06/20 20:29:24 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.63 2002/08/22 00:01:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,10 +17,10 @@ #include "access/heapam.h" #include "access/printtup.h" -#include "catalog/pg_type.h" #include "libpq/libpq.h" #include "libpq/pqformat.h" -#include "utils/syscache.h" +#include "utils/lsyscache.h" + static void printtup_setup(DestReceiver *self, int operation, const char *portalName, TupleDesc typeinfo); @@ -33,31 +33,6 @@ static void printtup_cleanup(DestReceiver *self); * ---------------------------------------------------------------- */ -/* ---------------- - * getTypeOutputInfo -- get info needed for printing values of a type - * ---------------- - */ -bool -getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem, - bool *typIsVarlena) -{ - HeapTuple typeTuple; - Form_pg_type pt; - - typeTuple = SearchSysCache(TYPEOID, - ObjectIdGetDatum(type), - 0, 0, 0); - if (!HeapTupleIsValid(typeTuple)) - elog(ERROR, "getTypeOutputInfo: Cache lookup of type %u failed", type); - pt = (Form_pg_type) GETSTRUCT(typeTuple); - - *typOutput = pt->typoutput; - *typElem = pt->typelem; - *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1); - ReleaseSysCache(typeTuple); - return OidIsValid(*typOutput); -} - /* ---------------- * Private state for a printtup destination object * ---------------- diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c index f8bf95ddc66b61b641b689703c9aa8c7caf2faaa..f7dc8e5d014123baf5cfcdce98c97266c9cdef83 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.74 2002/08/07 21:45:01 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.75 2002/08/22 00:01:41 tgl Exp $ * * NOTES * See acl.h. @@ -376,7 +376,7 @@ ExecuteGrantStmt_Function(GrantStmt *stmt) char replaces[Natts_pg_proc]; oid = LookupFuncNameTypeNames(func->funcname, func->funcargs, - true, stmt->is_grant ? "GRANT" : "REVOKE"); + stmt->is_grant ? "GRANT" : "REVOKE"); relation = heap_openr(ProcedureRelationName, RowExclusiveLock); tuple = SearchSysCache(PROCOID, diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c index 2f9f83dc78fde341faed7a7a8883f1470e013e2d..719d229b8d50d0d8bcab8c6f6581a21d283d2d22 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.53 2002/08/05 03:29:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.54 2002/08/22 00:01:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -67,13 +67,13 @@ AggregateCreate(const char *aggName, /* handle transfn */ MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid)); fnArgs[0] = aggTransType; - if (OidIsValid(aggBaseType)) + if (aggBaseType == ANYOID) + nargs = 1; + else { fnArgs[1] = aggBaseType; nargs = 2; } - else - nargs = 1; transfn = LookupFuncName(aggtransfnName, nargs, fnArgs); if (!OidIsValid(transfn)) func_error("AggregateCreate", aggtransfnName, nargs, fnArgs, NULL); diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c index 620ec7360cfaf58bb04d5337f8ce987321116ecc..8c6174608ff50adc3ae673bf94e55cda6eb498a6 100644 --- a/src/backend/catalog/pg_operator.c +++ b/src/backend/catalog/pg_operator.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.75 2002/08/05 03:29:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.76 2002/08/22 00:01:41 tgl Exp $ * * NOTES * these routines moved here from commands/define.c and somewhat cleaned up. @@ -464,9 +464,9 @@ OperatorCreate(const char *operatorName, if (restrictionName) { MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid)); - typeId[0] = 0; /* Query (opaque type) */ + typeId[0] = INTERNALOID; /* Query */ typeId[1] = OIDOID; /* operator OID */ - typeId[2] = 0; /* args list (opaque type) */ + typeId[2] = INTERNALOID; /* args list */ typeId[3] = INT4OID; /* varRelid */ restOid = LookupFuncName(restrictionName, 4, typeId); @@ -482,9 +482,9 @@ OperatorCreate(const char *operatorName, if (joinName) { MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid)); - typeId[0] = 0; /* Query (opaque type) */ + typeId[0] = INTERNALOID; /* Query */ typeId[1] = OIDOID; /* operator OID */ - typeId[2] = 0; /* args list (opaque type) */ + typeId[2] = INTERNALOID; /* args list */ joinOid = LookupFuncName(joinName, 3, typeId); if (!OidIsValid(joinOid)) diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c index f1b437be8d1b6700db7cb703b84f009fafb97ccd..9f14f78099435059815d9015f8589ab10bea03ee 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.88 2002/08/05 03:29:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.89 2002/08/22 00:01:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -502,7 +502,8 @@ fmgr_internal_validator(PG_FUNCTION_ARGS) elog(ERROR, "there is no built-in function named \"%s\"", prosrc); ReleaseSysCache(tuple); - PG_RETURN_BOOL(true); + + PG_RETURN_VOID(); } @@ -545,9 +546,9 @@ fmgr_c_validator(PG_FUNCTION_ARGS) (void) fetch_finfo_record(libraryhandle, prosrc); ReleaseSysCache(tuple); - PG_RETURN_BOOL(true); -} + PG_RETURN_VOID(); +} /* @@ -567,6 +568,7 @@ fmgr_sql_validator(PG_FUNCTION_ARGS) Datum tmp; char *prosrc; char functyptype; + int i; tuple = SearchSysCache(PROCOID, funcoid, 0, 0, 0); if (!HeapTupleIsValid(tuple)) @@ -574,8 +576,19 @@ fmgr_sql_validator(PG_FUNCTION_ARGS) proc = (Form_pg_proc) GETSTRUCT(tuple); - if (!OidIsValid(proc->prorettype)) - elog(ERROR, "SQL functions cannot return type \"opaque\""); + /* Disallow pseudotypes in arguments and result */ + /* except that return type can be RECORD */ + if (get_typtype(proc->prorettype) == 'p' && + proc->prorettype != RECORDOID) + elog(ERROR, "SQL functions cannot return type %s", + format_type_be(proc->prorettype)); + + for (i = 0; i < proc->pronargs; i++) + { + if (get_typtype(proc->proargtypes[i]) == 'p') + elog(ERROR, "SQL functions cannot have arguments of type %s", + format_type_be(proc->proargtypes[i])); + } tmp = SysCacheGetAttr(PROCOID, tuple, Anum_pg_proc_prosrc, &isnull); if (isnull) @@ -590,5 +603,6 @@ fmgr_sql_validator(PG_FUNCTION_ARGS) checkretval(proc->prorettype, functyptype, querytree_list); ReleaseSysCache(tuple); - PG_RETURN_BOOL(true); + + PG_RETURN_VOID(); } diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c index 1b83f03f48136b7b31995147322f77e409f8a701..85ee9e3f5370ae8f8a2c69ecbe230c979a3a1275 100644 --- a/src/backend/commands/aggregatecmds.c +++ b/src/backend/commands/aggregatecmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/aggregatecmds.c,v 1.3 2002/07/12 18:43:15 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/aggregatecmds.c,v 1.4 2002/08/22 00:01:41 tgl Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -28,6 +28,7 @@ #include "catalog/namespace.h" #include "catalog/pg_aggregate.h" #include "catalog/pg_proc.h" +#include "catalog/pg_type.h" #include "commands/defrem.h" #include "miscadmin.h" #include "parser/parse_func.h" @@ -104,29 +105,23 @@ DefineAggregate(List *names, List *parameters) elog(ERROR, "Define: \"sfunc\" unspecified"); /* - * Handle the aggregate's base type (input data type). This can be - * specified as 'ANY' for a data-independent transition function, such - * as COUNT(*). + * look up the aggregate's base type (input datatype) and transtype. + * + * We have historically allowed the command to look like basetype = 'ANY' + * so we must do a case-insensitive comparison for the name ANY. Ugh. + * + * basetype can be a pseudo-type, but transtype can't, since we need + * to be able to store values of the transtype. */ - baseTypeId = LookupTypeName(baseType); - if (OidIsValid(baseTypeId)) - { - /* no need to allow aggregates on as-yet-undefined types */ - if (!get_typisdefined(baseTypeId)) - elog(ERROR, "Type \"%s\" is only a shell", - TypeNameToString(baseType)); - } + if (strcasecmp(TypeNameToString(baseType), "ANY") == 0) + baseTypeId = ANYOID; else - { - char *typnam = TypeNameToString(baseType); - - if (strcasecmp(typnam, "ANY") != 0) - elog(ERROR, "Type \"%s\" does not exist", typnam); - baseTypeId = InvalidOid; - } + baseTypeId = typenameTypeId(baseType); - /* handle transtype --- no special cases here */ transTypeId = typenameTypeId(transType); + if (get_typtype(transTypeId) == 'p') + elog(ERROR, "Aggregate transition datatype cannot be %s", + format_type_be(transTypeId)); /* * Most of the argument-checking is done inside of AggregateCreate @@ -159,14 +154,13 @@ RemoveAggregate(RemoveAggrStmt *stmt) * if a basetype is passed in, then attempt to find an aggregate for * that specific type. * - * else if the basetype is blank, then attempt to find an aggregate with - * a basetype of zero. This is valid. It means that the aggregate is - * to apply to all basetypes (eg, COUNT). + * else attempt to find an aggregate with a basetype of ANYOID. + * This means that the aggregate is to apply to all basetypes (eg, COUNT). */ if (aggType) basetypeID = typenameTypeId(aggType); else - basetypeID = InvalidOid; + basetypeID = ANYOID; procOid = find_aggregate_func("RemoveAggregate", aggName, basetypeID); diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c index 41ef71960de1d5186f11f12f611e5778a8b5e835..ce489280182a10ea4af5cc342b3c4e9a01cbb48d 100644 --- a/src/backend/commands/comment.c +++ b/src/backend/commands/comment.c @@ -7,7 +7,7 @@ * Copyright (c) 1996-2001, PostgreSQL Global Development Group * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.56 2002/08/09 16:45:14 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.57 2002/08/22 00:01:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -24,6 +24,7 @@ #include "catalog/pg_operator.h" #include "catalog/pg_rewrite.h" #include "catalog/pg_trigger.h" +#include "catalog/pg_type.h" #include "commands/comment.h" #include "commands/dbcommands.h" #include "miscadmin.h" @@ -628,7 +629,7 @@ CommentAggregate(List *aggregate, List *arguments, char *comment) if (aggtype) baseoid = typenameTypeId(aggtype); else - baseoid = InvalidOid; + baseoid = ANYOID; /* Now, attempt to find the actual tuple in pg_proc */ @@ -661,7 +662,7 @@ CommentProc(List *function, List *arguments, char *comment) /* Look up the procedure */ oid = LookupFuncNameTypeNames(function, arguments, - true, "CommentProc"); + "CommentProc"); /* Now, validate the user's ability to comment on this function */ diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c index a8785d768622b2a3cbc0be7ec9bbe459cf3f72ac..7d65a1a7854cea8e762136db42c5a653a991cf44 100644 --- a/src/backend/commands/conversioncmds.c +++ b/src/backend/commands/conversioncmds.c @@ -1,6 +1,6 @@ /*------------------------------------------------------------------------- * - * conversionmacmds.c + * conversioncmds.c * conversion creation command support code * * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/conversioncmds.c,v 1.2 2002/07/25 10:07:11 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/conversioncmds.c,v 1.3 2002/08/22 00:01:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -45,7 +45,7 @@ CreateConversionCommand(CreateConversionStmt *stmt) const char *to_encoding_name = stmt->to_encoding_name; List *func_name = stmt->func_name; - static Oid funcargs[] = {INT4OID, INT4OID, 0, 0, INT4OID}; + static Oid funcargs[] = {INT4OID, INT4OID, CSTRINGOID, CSTRINGOID, INT4OID}; /* Convert list of names to a name and namespace */ namespaceId = QualifiedNameGetCreationNamespace(stmt->conversion_name, &conversion_name); diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 2751fe01d9e5ae26cb05e9ce10f03f3381f49e23..e0bbe7560bb6a4e6331abba8ec37c0ad2062b97e 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.165 2002/08/19 15:08:46 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.166 2002/08/22 00:01:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -37,6 +37,7 @@ #include "utils/acl.h" #include "utils/builtins.h" #include "utils/relcache.h" +#include "utils/lsyscache.h" #include "utils/syscache.h" #ifdef MULTIBYTE diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 51d003600bbcb517900477ae913bacb0ab4f609c..6d6ad94a4ed1fe5b49610886f150641034bf0ed4 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.17 2002/08/11 17:44:12 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.18 2002/08/22 00:01:42 tgl Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the @@ -61,7 +61,9 @@ * allow a shell type to be used, or even created if the specified return type * doesn't exist yet. (Without this, there's no way to define the I/O procs * for a new type.) But SQL function creation won't cope, so error out if - * the target language is SQL. + * the target language is SQL. (We do this here, not in the SQL-function + * validator, so as not to produce a WARNING and then an ERROR for the same + * condition.) */ static void compute_return_type(TypeName *returnType, Oid languageOid, @@ -76,7 +78,8 @@ compute_return_type(TypeName *returnType, Oid languageOid, if (!get_typisdefined(rettype)) { if (languageOid == SQLlanguageId) - elog(ERROR, "SQL functions cannot return shell types"); + elog(ERROR, "SQL function cannot return shell type \"%s\"", + TypeNameToString(returnType)); else elog(WARNING, "Return type \"%s\" is only a shell", TypeNameToString(returnType)); @@ -85,29 +88,32 @@ compute_return_type(TypeName *returnType, Oid languageOid, else { char *typnam = TypeNameToString(returnType); + Oid namespaceId; + AclResult aclresult; + char *typname; - if (strcmp(typnam, "opaque") == 0) - rettype = InvalidOid; - else - { - Oid namespaceId; - AclResult aclresult; - char *typname; - - if (languageOid == SQLlanguageId) - elog(ERROR, "Type \"%s\" does not exist", typnam); - elog(WARNING, "ProcedureCreate: type %s is not yet defined", - typnam); - namespaceId = QualifiedNameGetCreationNamespace(returnType->names, - &typname); - aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(), - ACL_CREATE); - if (aclresult != ACLCHECK_OK) - aclcheck_error(aclresult, get_namespace_name(namespaceId)); - rettype = TypeShellMake(typname, namespaceId); - if (!OidIsValid(rettype)) - elog(ERROR, "could not create type %s", typnam); - } + /* + * Only C-coded functions can be I/O functions. We enforce this + * restriction here mainly to prevent littering the catalogs with + * shell types due to simple typos in user-defined function + * definitions. + */ + if (languageOid != INTERNALlanguageId && + languageOid != ClanguageId) + elog(ERROR, "Type \"%s\" does not exist", typnam); + + /* Otherwise, go ahead and make a shell type */ + elog(WARNING, "ProcedureCreate: type %s is not yet defined", + typnam); + namespaceId = QualifiedNameGetCreationNamespace(returnType->names, + &typname); + aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(), + ACL_CREATE); + if (aclresult != ACLCHECK_OK) + aclcheck_error(aclresult, get_namespace_name(namespaceId)); + rettype = TypeShellMake(typname, namespaceId); + if (!OidIsValid(rettype)) + elog(ERROR, "could not create type %s", typnam); } *prorettype_p = rettype; @@ -138,25 +144,24 @@ compute_parameter_types(List *argTypes, Oid languageOid, if (OidIsValid(toid)) { if (!get_typisdefined(toid)) - elog(WARNING, "Argument type \"%s\" is only a shell", - TypeNameToString(t)); - } - else - { - char *typnam = TypeNameToString(t); - - if (strcmp(typnam, "opaque") == 0) { + /* As above, hard error if language is SQL */ if (languageOid == SQLlanguageId) - elog(ERROR, "SQL functions cannot have arguments of type \"opaque\""); - toid = InvalidOid; + elog(ERROR, "SQL function cannot accept shell type \"%s\"", + TypeNameToString(t)); + else + elog(WARNING, "Argument type \"%s\" is only a shell", + TypeNameToString(t)); } - else - elog(ERROR, "Type \"%s\" does not exist", typnam); + } + else + { + elog(ERROR, "Type \"%s\" does not exist", + TypeNameToString(t)); } if (t->setof) - elog(ERROR, "functions cannot accept set arguments"); + elog(ERROR, "Functions cannot accept set arguments"); parameterTypes[parameterCount++] = toid; } @@ -492,7 +497,7 @@ RemoveFunction(RemoveFuncStmt *stmt) * Find the function, do permissions and validity checks */ funcOid = LookupFuncNameTypeNames(functionName, argTypes, - true, "RemoveFunction"); + "RemoveFunction"); tup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcOid), @@ -621,6 +626,23 @@ CreateCast(CreateCastStmt *stmt) if (sourcetypeid == targettypeid) elog(ERROR, "source data type and target data type are the same"); + /* No shells, no pseudo-types allowed */ + if (!get_typisdefined(sourcetypeid)) + elog(ERROR, "source data type %s is only a shell", + TypeNameToString(stmt->sourcetype)); + + if (!get_typisdefined(targettypeid)) + elog(ERROR, "target data type %s is only a shell", + TypeNameToString(stmt->targettype)); + + if (get_typtype(sourcetypeid) == 'p') + elog(ERROR, "source data type %s is a pseudo-type", + TypeNameToString(stmt->sourcetype)); + + if (get_typtype(targettypeid) == 'p') + elog(ERROR, "target data type %s is a pseudo-type", + TypeNameToString(stmt->targettype)); + if (!pg_type_ownercheck(sourcetypeid, GetUserId()) && !pg_type_ownercheck(targettypeid, GetUserId())) elog(ERROR, "must be owner of type %s or type %s", @@ -642,7 +664,6 @@ CreateCast(CreateCastStmt *stmt) { funcid = LookupFuncNameTypeNames(stmt->func->funcname, stmt->func->funcargs, - false, "CreateCast"); tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid), 0, 0, 0); diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c index f544dc9886c0b47e8bee19667b69dfc9ac68ac91..a0430a8786b13baebe1d5bac4dfdd83421f5c5e3 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.3 2002/08/05 03:29:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.4 2002/08/22 00:01:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -177,7 +177,7 @@ DefineOpClass(CreateOpClassStmt *stmt) elog(ERROR, "DefineOpClass: procedure number %d appears more than once", item->number); funcOid = LookupFuncNameTypeNames(item->name, item->args, - true, "DefineOpClass"); + "DefineOpClass"); /* Caller must have execute permission on functions */ aclresult = pg_proc_aclcheck(funcOid, GetUserId(), ACL_EXECUTE); diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index 9672e74ea9bc9c69464db98aff3e7e3290bb5ee1..8aa2addc5125f1b0f7e2149c35d4fc8b9a3f7e3b 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/proclang.c,v 1.40 2002/08/13 17:22:08 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/proclang.c,v 1.41 2002/08/22 00:01:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -71,17 +71,18 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) elog(ERROR, "Language %s already exists", languageName); /* - * Lookup the PL handler function and check that it is of return type - * Opaque + * Lookup the PL handler function and check that it is of the expected + * return type */ MemSet(typev, 0, sizeof(typev)); procOid = LookupFuncName(stmt->plhandler, 0, typev); if (!OidIsValid(procOid)) elog(ERROR, "function %s() doesn't exist", NameListToString(stmt->plhandler)); - if (get_func_rettype(procOid) != InvalidOid) - elog(ERROR, "function %s() does not return type \"opaque\"", - NameListToString(stmt->plhandler)); + if (get_func_rettype(procOid) != LANGUAGE_HANDLEROID) + elog(ERROR, "function %s() does not return type %s", + NameListToString(stmt->plhandler), + format_type_be(LANGUAGE_HANDLEROID)); /* validate the validator function */ if (stmt->plvalidator) @@ -91,6 +92,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) if (!OidIsValid(valProcOid)) elog(ERROR, "function %s(oid) doesn't exist", NameListToString(stmt->plvalidator)); + /* return value is ignored, so we don't check the type */ } else valProcOid = InvalidOid; diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 312bad43525a02fa5881db18655e965561bfad3d..82feb9333d704c68e822f474d02b7f1aad1a47cb 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.127 2002/08/18 11:20:05 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.128 2002/08/22 00:01:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,6 +23,7 @@ #include "catalog/pg_language.h" #include "catalog/pg_proc.h" #include "catalog/pg_trigger.h" +#include "catalog/pg_type.h" #include "commands/trigger.h" #include "executor/executor.h" #include "miscadmin.h" @@ -222,9 +223,15 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint) if (!HeapTupleIsValid(tuple)) elog(ERROR, "CreateTrigger: function %s() does not exist", NameListToString(stmt->funcname)); - if (((Form_pg_proc) GETSTRUCT(tuple))->prorettype != 0) - elog(ERROR, "CreateTrigger: function %s() must return OPAQUE", - NameListToString(stmt->funcname)); + if (((Form_pg_proc) GETSTRUCT(tuple))->prorettype != TRIGGEROID) + { + /* OPAQUE is deprecated, but allowed for backwards compatibility */ + if (((Form_pg_proc) GETSTRUCT(tuple))->prorettype == OPAQUEOID) + elog(NOTICE, "CreateTrigger: OPAQUE is deprecated, use type TRIGGER instead to define trigger functions"); + else + elog(ERROR, "CreateTrigger: function %s() must return TRIGGER", + NameListToString(stmt->funcname)); + } ReleaseSysCache(tuple); /* diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index f9f27d5867625d031edaebdf9fa7a7c9bfba0d2e..bfca9c7c8f2f2248464a2493c6b067cbb0f45d4e 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.9 2002/08/15 16:36:02 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.10 2002/08/22 00:01:42 tgl Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -49,7 +49,7 @@ #include "utils/syscache.h" -static Oid findTypeIOFunction(List *procname, bool isOutput); +static Oid findTypeIOFunction(List *procname, Oid typeOid, bool isOutput); /* * DefineType @@ -75,6 +75,7 @@ DefineType(List *names, List *parameters) char *shadow_type; List *pl; Oid typoid; + Oid resulttype; /* Convert list of names to a name and namespace */ typeNamespace = QualifiedNameGetCreationNamespace(names, &typeName); @@ -116,7 +117,13 @@ DefineType(List *names, List *parameters) delimiter = p[0]; } else if (strcasecmp(defel->defname, "element") == 0) + { elemType = typenameTypeId(defGetTypeName(defel)); + /* disallow arrays of pseudotypes */ + if (get_typtype(elemType) == 'p') + elog(ERROR, "Array element type cannot be %s", + format_type_be(elemType)); + } else if (strcasecmp(defel->defname, "default") == 0) defaultValue = defGetString(defel); else if (strcasecmp(defel->defname, "passedbyvalue") == 0) @@ -179,9 +186,36 @@ DefineType(List *names, List *parameters) if (outputName == NIL) elog(ERROR, "Define: \"output\" unspecified"); - /* Convert I/O proc names to OIDs */ - inputOid = findTypeIOFunction(inputName, false); - outputOid = findTypeIOFunction(outputName, true); + /* + * Look to see if type already exists (presumably as a shell; if not, + * TypeCreate will complain). If it does then the declarations of the + * I/O functions might use it. + */ + typoid = GetSysCacheOid(TYPENAMENSP, + CStringGetDatum(typeName), + ObjectIdGetDatum(typeNamespace), + 0, 0); + + /* + * Convert I/O proc names to OIDs + */ + inputOid = findTypeIOFunction(inputName, typoid, false); + outputOid = findTypeIOFunction(outputName, typoid, true); + + /* + * Verify that I/O procs return the expected thing. OPAQUE is an allowed + * (but deprecated) alternative to the fully type-safe choices. + */ + resulttype = get_func_rettype(inputOid); + if (!((OidIsValid(typoid) && resulttype == typoid) || + resulttype == OPAQUEOID)) + elog(ERROR, "Type input function %s must return %s or OPAQUE", + NameListToString(inputName), typeName); + resulttype = get_func_rettype(outputOid); + if (!(resulttype == CSTRINGOID || + resulttype == OPAQUEOID)) + elog(ERROR, "Type output function %s must return CSTRING or OPAQUE", + NameListToString(outputName)); /* * now have TypeCreate do all the real work. @@ -377,10 +411,9 @@ DefineDomain(CreateDomainStmt *stmt) basetypeoid = HeapTupleGetOid(typeTup); /* - * What we really don't want is domains of domains. This could cause all sorts - * of neat issues if we allow that. - * - * With testing, we may determine complex types should be allowed + * Base type must be a plain base type. Domains over pseudo types would + * create a security hole. Domains of domains might be made to work in + * the future, but not today. Ditto for domains over complex types. */ typtype = baseType->typtype; if (typtype != 'b') @@ -621,52 +654,109 @@ RemoveDomain(List *names, DropBehavior behavior) /* * Find a suitable I/O function for a type. + * + * typeOid is the type's OID, if it already exists as a shell type, + * otherwise InvalidOid. */ static Oid -findTypeIOFunction(List *procname, bool isOutput) +findTypeIOFunction(List *procname, Oid typeOid, bool isOutput) { Oid argList[FUNC_MAX_ARGS]; - int nargs; Oid procOid; - /* - * First look for a 1-argument func with all argtypes 0. This is - * valid for all kinds of procedure. - */ - MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid)); - - procOid = LookupFuncName(procname, 1, argList); - - if (!OidIsValid(procOid)) + if (isOutput) { /* - * Alternatively, input procedures may take 3 args (data - * value, element OID, atttypmod); the pg_proc argtype - * signature is 0,OIDOID,INT4OID. Output procedures may - * take 2 args (data value, element OID). + * Output functions can take a single argument of the type, + * or two arguments (data value, element OID). The signature + * may use OPAQUE in place of the actual type name; this is the + * only possibility if the type doesn't yet exist as a shell. */ - if (isOutput) - { - /* output proc */ - nargs = 2; - argList[1] = OIDOID; - } - else + if (OidIsValid(typeOid)) { - /* input proc */ - nargs = 3; + MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid)); + + argList[0] = typeOid; + + procOid = LookupFuncName(procname, 1, argList); + if (OidIsValid(procOid)) + return procOid; + argList[1] = OIDOID; - argList[2] = INT4OID; + + procOid = LookupFuncName(procname, 2, argList); + if (OidIsValid(procOid)) + return procOid; + } - procOid = LookupFuncName(procname, nargs, argList); - if (!OidIsValid(procOid)) - func_error("TypeCreate", procname, 1, argList, NULL); + MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid)); + + argList[0] = OPAQUEOID; + + procOid = LookupFuncName(procname, 1, argList); + if (OidIsValid(procOid)) + return procOid; + + argList[1] = OIDOID; + + procOid = LookupFuncName(procname, 2, argList); + if (OidIsValid(procOid)) + return procOid; + + /* Prefer type name over OPAQUE in the failure message. */ + if (OidIsValid(typeOid)) + argList[0] = typeOid; + + func_error("TypeCreate", procname, 1, argList, NULL); } + else + { + /* + * Input functions can take a single argument of type CSTRING, + * or three arguments (string, element OID, typmod). The signature + * may use OPAQUE in place of CSTRING. + */ + MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid)); + + argList[0] = CSTRINGOID; + + procOid = LookupFuncName(procname, 1, argList); + if (OidIsValid(procOid)) + return procOid; - return procOid; + argList[1] = OIDOID; + argList[2] = INT4OID; + + procOid = LookupFuncName(procname, 3, argList); + if (OidIsValid(procOid)) + return procOid; + + MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid)); + + argList[0] = OPAQUEOID; + + procOid = LookupFuncName(procname, 1, argList); + if (OidIsValid(procOid)) + return procOid; + + argList[1] = OIDOID; + argList[2] = INT4OID; + + procOid = LookupFuncName(procname, 3, argList); + if (OidIsValid(procOid)) + return procOid; + + /* Use CSTRING (preferred) in the error message */ + argList[0] = CSTRINGOID; + + func_error("TypeCreate", procname, 1, argList, NULL); + } + + return InvalidOid; /* keep compiler quiet */ } + /*------------------------------------------------------------------- * DefineCompositeType * diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index b47250558850792d42dc42ab4988a47e1e6029f4..1016c782d29d11f741e7693219233abe319ff8ff 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.79 2002/07/20 05:29:01 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.80 2002/08/22 00:01:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -47,7 +47,6 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Node *result; if (targetTypeId == inputTypeId || - targetTypeId == InvalidOid || node == NULL) { /* no conversion needed, but constraints may need to be applied */ @@ -97,6 +96,12 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, if (targetTypeId != baseTypeId) result = (Node *) TypeConstraints(result, targetTypeId); } + else if (targetTypeId == ANYOID || + targetTypeId == ANYARRAYOID) + { + /* assume can_coerce_type verified that implicit coercion is okay */ + result = node; + } else if (IsBinaryCompatible(inputTypeId, targetTypeId)) { /* @@ -213,18 +218,10 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids, if (inputTypeId == targetTypeId) continue; - /* - * one of the known-good transparent conversions? then drop - * through... - */ - if (IsBinaryCompatible(inputTypeId, targetTypeId)) - continue; - - /* don't know what to do for the output type? then quit... */ - if (targetTypeId == InvalidOid) + /* don't choke on references to no-longer-existing types */ + if (!typeidIsValid(inputTypeId)) return false; - /* don't know what to do for the input type? then quit... */ - if (inputTypeId == InvalidOid) + if (!typeidIsValid(targetTypeId)) return false; /* @@ -238,18 +235,44 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids, continue; } + /* accept if target is ANY */ + if (targetTypeId == ANYOID) + continue; + + /* if target is ANYARRAY and source is a varlena array type, accept */ + if (targetTypeId == ANYARRAYOID) + { + Oid typOutput; + Oid typElem; + bool typIsVarlena; + + if (getTypeOutputInfo(inputTypeId, &typOutput, &typElem, + &typIsVarlena)) + { + if (OidIsValid(typElem) && typIsVarlena) + continue; + } + /* + * Otherwise reject; this assumes there are no explicit coercions + * to ANYARRAY. If we don't reject then parse_coerce would have + * to repeat the above test. + */ + return false; + } + + /* + * one of the known-good transparent conversions? then drop + * through... + */ + if (IsBinaryCompatible(inputTypeId, targetTypeId)) + continue; + /* * If input is a class type that inherits from target, no problem */ if (typeInheritsFrom(inputTypeId, targetTypeId)) continue; - /* don't choke on references to no-longer-existing types */ - if (!typeidIsValid(inputTypeId)) - return false; - if (!typeidIsValid(targetTypeId)) - return false; - /* * Else, try for run-time conversion using functions: look for a * single-argument function named with the target type name and diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index edd0e8109579712a15a9d67c3c6070a094374ed7..87e432b7cf3c820fab0ae381fde71a343829bb8c 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.134 2002/08/08 01:44:30 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.135 2002/08/22 00:01:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1264,10 +1264,7 @@ func_error(const char *caller, List *funcname, { if (i) appendStringInfo(&argbuf, ", "); - if (OidIsValid(argtypes[i])) - appendStringInfo(&argbuf, format_type_be(argtypes[i])); - else - appendStringInfo(&argbuf, "opaque"); + appendStringInfo(&argbuf, format_type_be(argtypes[i])); } if (caller == NULL) @@ -1289,7 +1286,7 @@ func_error(const char *caller, List *funcname, * Convenience routine to check that a function exists and is an * aggregate. * - * Note: basetype is InvalidOid if we are looking for an aggregate on + * Note: basetype is ANYOID if we are looking for an aggregate on * all types. */ Oid @@ -1303,7 +1300,7 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype) if (!OidIsValid(oid)) { - if (basetype == InvalidOid) + if (basetype == ANYOID) elog(ERROR, "%s: aggregate %s(*) does not exist", caller, NameListToString(aggname)); else @@ -1322,7 +1319,7 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype) if (!pform->proisagg) { - if (basetype == InvalidOid) + if (basetype == ANYOID) elog(ERROR, "%s: function %s(*) is not an aggregate", caller, NameListToString(aggname)); else @@ -1366,12 +1363,9 @@ LookupFuncName(List *funcname, int nargs, const Oid *argtypes) * Like LookupFuncName, but the argument types are specified by a * list of TypeName nodes. Also, if we fail to find the function * and caller is not NULL, then an error is reported via func_error. - * - * "opaque" is accepted as a typename only if opaqueOK is true. */ Oid -LookupFuncNameTypeNames(List *funcname, List *argtypes, bool opaqueOK, - const char *caller) +LookupFuncNameTypeNames(List *funcname, List *argtypes, const char *caller) { Oid funcoid; Oid argoids[FUNC_MAX_ARGS]; @@ -1389,15 +1383,10 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool opaqueOK, TypeName *t = (TypeName *) lfirst(argtypes); argoids[i] = LookupTypeName(t); - if (!OidIsValid(argoids[i])) - { - char *typnam = TypeNameToString(t); - if (opaqueOK && strcmp(typnam, "opaque") == 0) - argoids[i] = InvalidOid; - else - elog(ERROR, "Type \"%s\" does not exist", typnam); - } + if (!OidIsValid(argoids[i])) + elog(ERROR, "Type \"%s\" does not exist", + TypeNameToString(t)); argtypes = lnext(argtypes); } diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefile index 3cbd1a8fa5854aac648202221eaa228c3ea1be54..0685daa5045fce28480c52428ec1f4669a3e11e2 100644 --- a/src/backend/utils/adt/Makefile +++ b/src/backend/utils/adt/Makefile @@ -1,7 +1,7 @@ # # Makefile for utils/adt # -# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.52 2002/08/17 13:04:15 momjian Exp $ +# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.53 2002/08/22 00:01:43 tgl Exp $ # subdir = src/backend/utils/adt @@ -19,7 +19,7 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o \ date.o datetime.o datum.o float.o format_type.o \ geo_ops.o geo_selfuncs.o int.o int8.o like.o lockfuncs.o \ misc.o nabstime.o name.o not_in.o numeric.o numutils.o \ - oid.o oracle_compat.o \ + oid.o oracle_compat.o pseudotypes.o \ regexp.o regproc.o ruleutils.o selfuncs.o sets.o \ tid.o timestamp.o varbit.o varchar.o varlena.o version.o \ network.o mac.o inet_net_ntop.o inet_net_pton.o \ diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c index c228e85ae8e0fd3cc4b5f0f0bc51fcefe25ce385..859e78b58cb724bb2fb61d39822460727466fe2e 100644 --- a/src/backend/utils/adt/int.c +++ b/src/backend/utils/adt/int.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.51 2002/06/20 20:29:37 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.52 2002/08/22 00:01:43 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -144,59 +144,6 @@ int2vectoreq(PG_FUNCTION_ARGS) PG_RETURN_BOOL(memcmp(arg1, arg2, INDEX_MAX_KEYS * sizeof(int16)) == 0); } -/* - * Type int44 has no real-world use, but the regression tests use it. - * It's a four-element vector of int4's. - */ - -/* - * int44in - converts "num num ..." to internal form - * - * Note: Fills any missing positions with zeroes. - */ -Datum -int44in(PG_FUNCTION_ARGS) -{ - char *input_string = PG_GETARG_CSTRING(0); - int32 *result = (int32 *) palloc(4 * sizeof(int32)); - int i; - - i = sscanf(input_string, - "%d, %d, %d, %d", - &result[0], - &result[1], - &result[2], - &result[3]); - while (i < 4) - result[i++] = 0; - - PG_RETURN_POINTER(result); -} - -/* - * int44out - converts internal form to "num num ..." - */ -Datum -int44out(PG_FUNCTION_ARGS) -{ - int32 *an_array = (int32 *) PG_GETARG_POINTER(0); - char *result = (char *) palloc(16 * 4); /* Allow 14 digits + - * sign */ - int i; - char *walk; - - walk = result; - for (i = 0; i < 4; i++) - { - pg_ltoa(an_array[i], walk); - while (*++walk != '\0') - ; - *walk++ = ' '; - } - *--walk = '\0'; - PG_RETURN_CSTRING(result); -} - /***************************************************************************** * PUBLIC ROUTINES * diff --git a/src/backend/utils/adt/pseudotypes.c b/src/backend/utils/adt/pseudotypes.c new file mode 100644 index 0000000000000000000000000000000000000000..7e5cd2950d85d246dec65fdff0ffa9531516b3ba --- /dev/null +++ b/src/backend/utils/adt/pseudotypes.c @@ -0,0 +1,234 @@ +/*------------------------------------------------------------------------- + * + * pseudotypes.c + * Functions for the system pseudo-types. + * + * A pseudo-type isn't really a type and never has any operations, but + * we do need to supply input and output functions to satisfy the links + * in the pseudo-type's entry in pg_type. In most cases the functions + * just throw an error if invoked. (XXX the error messages here cover + * the most common case, but might be confusing in some contexts. Can + * we do better?) + * + * + * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * + * IDENTIFICATION + * $Header: /cvsroot/pgsql/src/backend/utils/adt/pseudotypes.c,v 1.1 2002/08/22 00:01:43 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#include "postgres.h" + +#include "utils/builtins.h" + + +/* + * record_in - input routine for pseudo-type RECORD. + */ +Datum +record_in(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot accept a constant of type %s", "RECORD"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + +/* + * record_out - output routine for pseudo-type RECORD. + */ +Datum +record_out(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot display a value of type %s", "RECORD"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + + +/* + * cstring_in - input routine for pseudo-type CSTRING. + */ +Datum +cstring_in(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot accept a constant of type %s", "CSTRING"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + +/* + * cstring_out - output routine for pseudo-type CSTRING. + */ +Datum +cstring_out(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot display a value of type %s", "CSTRING"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + + +/* + * any_in - input routine for pseudo-type ANY. + */ +Datum +any_in(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot accept a constant of type %s", "ANY"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + +/* + * any_out - output routine for pseudo-type ANY. + */ +Datum +any_out(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot display a value of type %s", "ANY"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + + +/* + * anyarray_in - input routine for pseudo-type ANYARRAY. + */ +Datum +anyarray_in(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot accept a constant of type %s", "ANYARRAY"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + +/* + * anyarray_out - output routine for pseudo-type ANYARRAY. + */ +Datum +anyarray_out(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot display a value of type %s", "ANYARRAY"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + + +/* + * void_in - input routine for pseudo-type VOID. + * + * We allow this so that PL functions can return VOID without any special + * hack in the PL handler. Whatever value the PL thinks it's returning + * will just be ignored. + */ +Datum +void_in(PG_FUNCTION_ARGS) +{ + PG_RETURN_VOID(); /* you were expecting something different? */ +} + +/* + * void_out - output routine for pseudo-type VOID. + * + * We allow this so that "SELECT function_returning_void(...)" works. + */ +Datum +void_out(PG_FUNCTION_ARGS) +{ + PG_RETURN_CSTRING(pstrdup("")); +} + + +/* + * trigger_in - input routine for pseudo-type TRIGGER. + */ +Datum +trigger_in(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot accept a constant of type %s", "TRIGGER"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + +/* + * trigger_out - output routine for pseudo-type TRIGGER. + */ +Datum +trigger_out(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot display a value of type %s", "TRIGGER"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + + +/* + * language_handler_in - input routine for pseudo-type LANGUAGE_HANDLER. + */ +Datum +language_handler_in(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot accept a constant of type %s", "LANGUAGE_HANDLER"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + +/* + * language_handler_out - output routine for pseudo-type LANGUAGE_HANDLER. + */ +Datum +language_handler_out(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot display a value of type %s", "LANGUAGE_HANDLER"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + + +/* + * internal_in - input routine for pseudo-type INTERNAL. + */ +Datum +internal_in(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot accept a constant of type %s", "INTERNAL"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + +/* + * internal_out - output routine for pseudo-type INTERNAL. + */ +Datum +internal_out(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot display a value of type %s", "INTERNAL"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + + +/* + * opaque_in - input routine for pseudo-type OPAQUE. + */ +Datum +opaque_in(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot accept a constant of type %s", "OPAQUE"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} + +/* + * opaque_out - output routine for pseudo-type OPAQUE. + */ +Datum +opaque_out(PG_FUNCTION_ARGS) +{ + elog(ERROR, "Cannot display a value of type %s", "OPAQUE"); + + PG_RETURN_VOID(); /* keep compiler quiet */ +} diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c index 42dd50ccd703ec122f5bcfb2c7a82092e719567d..c99685d675f3051d93237bf77d636cd715b3cd10 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.72 2002/07/29 22:14:11 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.73 2002/08/22 00:01:43 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -38,7 +38,7 @@ #include "utils/syscache.h" static void parseNameAndArgTypes(const char *string, const char *caller, - const char *type0_spelling, + bool allowNone, List **names, int *nargs, Oid *argtypes); @@ -260,7 +260,7 @@ regprocedurein(PG_FUNCTION_ARGS) * datatype cannot be used for any system column that needs to receive * data during bootstrap. */ - parseNameAndArgTypes(pro_name_or_oid, "regprocedurein", "opaque", + parseNameAndArgTypes(pro_name_or_oid, "regprocedurein", false, &names, &nargs, argtypes); clist = FuncnameGetCandidates(names, nargs); @@ -325,10 +325,7 @@ format_procedure(Oid procedure_oid) if (i > 0) appendStringInfoChar(&buf, ','); - if (OidIsValid(thisargtype)) - appendStringInfo(&buf, "%s", format_type_be(thisargtype)); - else - appendStringInfo(&buf, "opaque"); + appendStringInfo(&buf, "%s", format_type_be(thisargtype)); } appendStringInfoChar(&buf, ')'); @@ -584,7 +581,7 @@ regoperatorin(PG_FUNCTION_ARGS) * datatype cannot be used for any system column that needs to receive * data during bootstrap. */ - parseNameAndArgTypes(opr_name_or_oid, "regoperatorin", "none", + parseNameAndArgTypes(opr_name_or_oid, "regoperatorin", true, &names, &nargs, argtypes); if (nargs == 1) elog(ERROR, "regoperatorin: use NONE to denote the missing argument of a unary operator"); @@ -1036,12 +1033,12 @@ stringToQualifiedNameList(const char *string, const char *caller) * the argtypes array should be of size FUNC_MAX_ARGS). The function or * operator name is returned to *names as a List of Strings. * - * If type0_spelling is not NULL, it is a name to be accepted as a - * placeholder for OID 0. + * If allowNone is TRUE, accept "NONE" and return it as InvalidOid (this is + * for unary operators). */ static void parseNameAndArgTypes(const char *string, const char *caller, - const char *type0_spelling, + bool allowNone, List **names, int *nargs, Oid *argtypes) { char *rawname; @@ -1147,9 +1144,9 @@ parseNameAndArgTypes(const char *string, const char *caller, *ptr2 = '\0'; } - if (type0_spelling && strcasecmp(typename, type0_spelling) == 0) + if (allowNone && strcasecmp(typename, "none") == 0) { - /* Special case for OPAQUE or NONE */ + /* Special case for NONE */ typeid = InvalidOid; typmod = -1; } diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 10fc2d29e036ee85d96e9b8cda35981de47692ec..986c7659f2ceb4c815f04b92a9b6af65ce1b813e 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.112 2002/06/20 20:29:38 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.113 2002/08/22 00:01:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ * * This is represented at the SQL level (in pg_proc) as * - * float8 oprrest (opaque, oid, opaque, int4); + * float8 oprrest (internal, oid, internal, int4); * * The call convention for a join estimator (oprjoin function) is similar * except that varRelid is not needed: @@ -62,7 +62,7 @@ * Oid operator, * List *args); * - * float8 oprjoin (opaque, oid, opaque); + * float8 oprjoin (internal, oid, internal); *---------- */ diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 4c2838e7af7bf89fce48085b6e592fe8b95623a3..a916dc94012f59d272118574ee481774440ecc57 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.78 2002/08/05 02:30:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.79 2002/08/22 00:01:44 tgl Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -1166,6 +1166,34 @@ get_typtype(Oid typid) return '\0'; } +/* + * getTypeOutputInfo + * + * Get info needed for printing values of a type + * + * Returns true if data valid (a false result probably means it's a shell type) + */ +bool +getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem, + bool *typIsVarlena) +{ + HeapTuple typeTuple; + Form_pg_type pt; + + typeTuple = SearchSysCache(TYPEOID, + ObjectIdGetDatum(type), + 0, 0, 0); + if (!HeapTupleIsValid(typeTuple)) + elog(ERROR, "getTypeOutputInfo: Cache lookup of type %u failed", type); + pt = (Form_pg_type) GETSTRUCT(typeTuple); + + *typOutput = pt->typoutput; + *typElem = pt->typelem; + *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1); + ReleaseSysCache(typeTuple); + return OidIsValid(*typOutput); +} + /* ---------- STATISTICS CACHE ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/Makefile b/src/backend/utils/mb/conversion_procs/Makefile index 75436d5dee9b502d8af76eec195d2869a4d318aa..8e843bf44f54d00f992a41de80533527b2fceef0 100644 --- a/src/backend/utils/mb/conversion_procs/Makefile +++ b/src/backend/utils/mb/conversion_procs/Makefile @@ -4,7 +4,7 @@ # Makefile for utils/mb/conversion_procs # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.4 2002/08/14 02:45:10 ishii Exp $ +# $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.5 2002/08/22 00:01:44 tgl Exp $ # #------------------------------------------------------------------------- @@ -153,7 +153,7 @@ $(SQLSCRIPT): Makefile func=$$1; shift; \ obj=$$1; shift; \ echo "-- $$se --> $$de"; \ - echo "CREATE OR REPLACE FUNCTION $$func (INTEGER, INTEGER, OPAQUE, OPAQUE, INTEGER) RETURNS INTEGER AS '$$"libdir"/$$obj', '$$func' LANGUAGE 'c';"; \ + echo "CREATE OR REPLACE FUNCTION $$func (INTEGER, INTEGER, CSTRING, CSTRING, INTEGER) RETURNS VOID AS '$$"libdir"/$$obj', '$$func' LANGUAGE 'c';"; \ echo "DROP CONVERSION pg_catalog.$$name;"; \ echo "CREATE DEFAULT CONVERSION pg_catalog.$$name FOR '$$se' TO '$$de' FROM $$func;"; \ done > $@ diff --git a/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c b/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c index ed00f189091d14780ab2379802c3ce53576e6394..2c827e8990d3bb3e12456a8b6ec7e1df64ea234f 100644 --- a/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -25,10 +25,10 @@ extern Datum mic_to_ascii(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c b/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c index b336504edea5cf7235234e6ba390a3fa6e6b1acc..a870deec87f40511e3d1762de2110a154c672b81 100644 --- a/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -63,10 +63,10 @@ extern Datum alt_to_iso(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c b/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c index 29b1442b607089be0dd9a96982a0276e457ac801..c443aa8a23588564cdccf6c995fec0ebf58ca88b 100644 --- a/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -25,10 +25,10 @@ extern Datum mic_to_euc_cn(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c b/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c index a5ae4c6ac68a40c372f26a3705a5f418a253b34a..cc98298986f1bc0e1c18b857d048d44b0ff29bc7 100644 --- a/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c +++ b/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.2 2002/08/22 00:01:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -47,10 +47,10 @@ extern Datum mic_to_sjis(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c b/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c index 4c0d09758b543487246976d85e1dce1b5fa99b2e..43e69f7a070d7e64d8fc82fd27a449ec504e1373 100644 --- a/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -25,10 +25,10 @@ extern Datum mic_to_euc_kr(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c index 591f7f38b93c5867a2fbdc7735749bf28feefbb0..112bdc1a4a7350573a3ba1e102b2cab3a3ee1699 100644 --- a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c +++ b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.2 2002/08/22 00:01:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -35,10 +35,10 @@ extern Datum mic_to_big5(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c b/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c index 1f75394d04c58c1037c10c1816b81fbeca71f82b..f3a6476d4cacb79554728e6349eaf3b132efc05f 100644 --- a/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c +++ b/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.2 2002/08/22 00:01:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -35,10 +35,10 @@ extern Datum win1250_to_latin2(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c b/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c index a019fc274ffab4c470412a25209ac3f911611693..e6122f49ae9c76a5b3428b3616e30e44d0b97ee3 100644 --- a/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -33,10 +33,10 @@ extern Datum mic_to_latin4(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c b/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c index db84f9f05dcae28cbc86dbd1dd8cabe953732688..581cebbb5d2ff83f1cbea4760e8688dfe5f493ad 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -25,10 +25,10 @@ extern Datum utf8_to_ascii(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c b/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c index b40db46665e9d5b9dd3870bb6638bba9e7669f87..7b6c16ac3099a4bc6ef169cf5fdb90078d9c41ad 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_big5(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c b/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c index cc16a46aca847a22158b33aeaf5b3a06942c4cf0..3135d150331959623466ae6535f5bb56ef42631c 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -39,10 +39,10 @@ extern Datum alt_to_utf8(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c b/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c index e5edd24b7bd7c1ea1fbc15cc4e465c65df6a2ede..b0213011940ef372cfc33a6e23f3cf02b88eae36 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_euc_cn(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c b/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c index 8d702f391c26264f486f992a3a64c9d4d9a36e57..d71af151318fb252dbf07e6104788a15467b0bd7 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_euc_jp(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c b/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c index 9f2761134b5e275b01934a4cb8f5aee7699d386b..7833950010ebd3e85ab82eb68237f2755cfb70bf 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_euc_kr(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c b/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c index bafa218167e25dcd603c723e997ce0c41e874e30..7a8bff0cb58dc3d502f2593bf4f22ddc38842629 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_euc_tw(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c b/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c index 4587448a90c352f4ad470ed4e42e0d897a036225..034651501eaf19876940048ca0a422a8c2b7e157 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_gb18030(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c b/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c index d81c4d7a1875dbaac797b503a0b395bdb7b0b61e..a6ec76c9eed116235adc35bee35717a861bd8760 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_gbk(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c index 5f270aadb4a4490fbb4e605fb923f56700c9517e..6c373bfa51a463bf6fd14c0f90d18b11a0facc45 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -51,10 +51,10 @@ extern Datum utf8_to_iso8859(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c index 80c91a067dbd69de926c2cf59a4b36a816970f35..e66de79ba1598cf183c24ae4c7ef471c7bc2c17b 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.1 2002/07/16 09:25:05 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -25,10 +25,10 @@ extern Datum utf8_to_iso8859_1(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c b/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c index e05e30e858ce5fdf418bbec7528d29669c4b1558..4dbd33fdd0c5ff3b95b63db1bd56b653e8e69f29 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.1 2002/07/16 09:25:06 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_johab(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c b/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c index 50739f9f0938c4852e496db5ac572a8b43fcf1b6..a460768f21674e37e38ef52d0a0eccfaa5719386 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.1 2002/07/16 09:25:06 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_sjis(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c b/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c index 7486bcad7328794b636e868dc782ee7f27acffd4..6847458df4c3112554fd3aacaf9776bbc372b3fd 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/Attic/utf8_and_tcvn.c,v 1.1 2002/07/16 09:25:06 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/Attic/utf8_and_tcvn.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_tcvn(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c b/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c index 8a8f479c75b74b3be4d56303b1f0864933ff9434..d30f3de3a3474f97b42113eb18e39fdbffd9831d 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.1 2002/07/16 09:25:06 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum utf8_to_uhc(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c b/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c index 8e61fce00cb1f43540673989685c0702498f17ad..6b32fe78e2a20a2d003135a6034f883ec5e663b7 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/Attic/utf8_and_win1250.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/Attic/utf8_and_win1250.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum win1250_to_utf(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c b/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c index 55818f40bbe4c64c2facd1d089362dfb88543268..4014330b0a3b0ab81134575600444a09752b2d2a 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/Attic/utf8_and_win1256.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/Attic/utf8_and_win1256.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum win1256_to_utf(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c b/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c index f343dba68605985d3e0225e40db8a2e54a5d7765..9192db3ccf35f801e7ecad6a5d89a1dc7079260b 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/Attic/utf8_and_win874.c,v 1.1 2002/08/14 02:45:10 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/Attic/utf8_and_win874.c,v 1.2 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,10 @@ extern Datum win874_to_utf(PG_FUNCTION_ARGS); * conv_proc( * INTEGER, -- source encoding id * INTEGER, -- destination encoding id - * OPAQUE, -- source string (null terminated C string) - * OPAQUE, -- destination string (null terminated C string) + * CSTRING, -- source string (null terminated C string) + * CSTRING, -- destination string (null terminated C string) * INTEGER -- source string length - * ) returns INTEGER; -- dummy. returns nothing, actually. + * ) returns VOID; * ---------- */ diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 692087d5efd29768dad0cb442498938b9618b52d..b25d466feb6c58c3d2cd3f2a5ebc8de08d838aae 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -22,7 +22,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.288 2002/08/20 17:54:44 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.289 2002/08/22 00:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1899,6 +1899,7 @@ getAggregates(int *numAggs) write_msg(NULL, "WARNING: owner of aggregate function \"%s\" appears to be invalid\n", agginfo[i].aggname); agginfo[i].aggacl = strdup(PQgetvalue(res, i, i_aggacl)); + agginfo[i].anybasetype = false; /* computed when it's dumped */ agginfo[i].fmtbasetype = NULL; /* computed when it's dumped */ } @@ -3044,7 +3045,7 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo, /* DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP TYPE %s.", fmtId(tinfo->typnamespace->nspname)); - appendPQExpBuffer(delq, "%s;\n", + appendPQExpBuffer(delq, "%s CASCADE;\n", fmtId(tinfo->typname)); appendPQExpBuffer(q, @@ -4502,7 +4503,6 @@ static char * format_aggregate_signature(AggInfo *agginfo, Archive *fout, bool honor_quotes) { PQExpBufferData buf; - bool anybasetype; initPQExpBuffer(&buf); if (honor_quotes) @@ -4511,19 +4511,17 @@ format_aggregate_signature(AggInfo *agginfo, Archive *fout, bool honor_quotes) else appendPQExpBuffer(&buf, "%s", agginfo->aggname); - anybasetype = (strcmp(agginfo->aggbasetype, "0") == 0); - /* If using regtype or format_type, fmtbasetype is already quoted */ if (fout->remoteVersion >= 70100) { - if (anybasetype) + if (agginfo->anybasetype) appendPQExpBuffer(&buf, "(*)"); else appendPQExpBuffer(&buf, "(%s)", agginfo->fmtbasetype); } else { - if (anybasetype) + if (agginfo->anybasetype) appendPQExpBuffer(&buf, "(*)"); else appendPQExpBuffer(&buf, "(%s)", @@ -4568,6 +4566,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) int i_aggfinalfn; int i_aggtranstype; int i_agginitval; + int i_anybasetype; int i_fmtbasetype; int i_convertok; const char *aggtransfn; @@ -4575,7 +4574,6 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) const char *aggtranstype; const char *agginitval; bool convertok; - bool anybasetype; /* Make sure we are in proper schema */ selectSourceSchema(agginfo->aggnamespace->nspname); @@ -4586,6 +4584,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) appendPQExpBuffer(query, "SELECT aggtransfn, " "aggfinalfn, aggtranstype::pg_catalog.regtype, " "agginitval, " + "proargtypes[0] = 'pg_catalog.\"any\"'::pg_catalog.regtype as anybasetype, " "proargtypes[0]::pg_catalog.regtype as fmtbasetype, " "'t'::boolean as convertok " "from pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " @@ -4598,6 +4597,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) appendPQExpBuffer(query, "SELECT aggtransfn, aggfinalfn, " "format_type(aggtranstype, NULL) as aggtranstype, " "agginitval, " + "aggbasetype = 0 as anybasetype, " "CASE WHEN aggbasetype = 0 THEN '-' " "ELSE format_type(aggbasetype, NULL) END as fmtbasetype, " "'t'::boolean as convertok " @@ -4611,6 +4611,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) "aggfinalfn, " "(select typname from pg_type where oid = aggtranstype1) as aggtranstype, " "agginitval1 as agginitval, " + "aggbasetype = 0 as anybasetype, " "(select typname from pg_type where oid = aggbasetype) as fmtbasetype, " "(aggtransfn2 = 0 and aggtranstype2 = 0 and agginitval2 is null) as convertok " "from pg_aggregate " @@ -4640,6 +4641,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) i_aggfinalfn = PQfnumber(res, "aggfinalfn"); i_aggtranstype = PQfnumber(res, "aggtranstype"); i_agginitval = PQfnumber(res, "agginitval"); + i_anybasetype = PQfnumber(res, "anybasetype"); i_fmtbasetype = PQfnumber(res, "fmtbasetype"); i_convertok = PQfnumber(res, "convertok"); @@ -4647,6 +4649,8 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) aggfinalfn = PQgetvalue(res, 0, i_aggfinalfn); aggtranstype = PQgetvalue(res, 0, i_aggtranstype); agginitval = PQgetvalue(res, 0, i_agginitval); + /* we save anybasetype so that dumpAggACL can use it later */ + agginfo->anybasetype = (PQgetvalue(res, 0, i_anybasetype)[0] == 't'); /* we save fmtbasetype so that dumpAggACL can use it later */ agginfo->fmtbasetype = strdup(PQgetvalue(res, 0, i_fmtbasetype)); convertok = (PQgetvalue(res, 0, i_convertok)[0] == 't'); @@ -4669,13 +4673,12 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) return; } - anybasetype = (strcmp(agginfo->aggbasetype, "0") == 0); - if (g_fout->remoteVersion >= 70300) { /* If using 7.3's regproc or regtype, data is already quoted */ appendPQExpBuffer(details, " BASETYPE = %s,\n SFUNC = %s,\n STYPE = %s", - anybasetype ? "'any'" : agginfo->fmtbasetype, + agginfo->anybasetype ? "'any'" : + agginfo->fmtbasetype, aggtransfn, aggtranstype); } @@ -4683,7 +4686,8 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) { /* format_type quotes, regproc does not */ appendPQExpBuffer(details, " BASETYPE = %s,\n SFUNC = %s,\n STYPE = %s", - anybasetype ? "'any'" : agginfo->fmtbasetype, + agginfo->anybasetype ? "'any'" : + agginfo->fmtbasetype, fmtId(aggtransfn), aggtranstype); } @@ -4691,7 +4695,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo) { /* need quotes all around */ appendPQExpBuffer(details, " BASETYPE = %s,\n", - anybasetype ? "'any'" : + agginfo->anybasetype ? "'any'" : fmtId(agginfo->fmtbasetype)); appendPQExpBuffer(details, " SFUNC = %s,\n", fmtId(aggtransfn)); diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index 060c4396b4293d3444b25cf0863e3bbcfaa513a8..d89a06c18669dda2a50b779b028be8226bbbdf78 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_dump.h,v 1.97 2002/08/19 19:33:35 tgl Exp $ + * $Id: pg_dump.h,v 1.98 2002/08/22 00:01:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -74,6 +74,7 @@ typedef struct _aggInfo NamespaceInfo *aggnamespace; /* link to containing namespace */ char *usename; char *aggacl; + bool anybasetype; /* is the basetype "any"? */ char *fmtbasetype; /* formatted type name */ } AggInfo; diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 9ba7bcc36fe0cb41ae94d84facd8fc95ba4553f8..538672954ea3ec71430223f80ae8c63363b397be 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3,7 +3,7 @@ * * Copyright 2000-2002 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.62 2002/08/16 23:01:19 tgl Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.63 2002/08/22 00:01:47 tgl Exp $ */ #include "postgres_fe.h" #include "describe.h" @@ -68,13 +68,14 @@ describeAggregates(const char *pattern, bool verbose) /* * There are two kinds of aggregates: ones that work on particular - * types and ones that work on all (denoted by input type = 0) + * types and ones that work on all (denoted by input type = "any") */ printfPQExpBuffer(&buf, "SELECT n.nspname as \"%s\",\n" " p.proname AS \"%s\",\n" " CASE p.proargtypes[0]\n" - " WHEN 0 THEN CAST('%s' AS pg_catalog.text)\n" + " WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype\n" + " THEN CAST('%s' AS pg_catalog.text)\n" " ELSE pg_catalog.format_type(p.proargtypes[0], NULL)\n" " END AS \"%s\",\n" " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n" @@ -146,12 +147,11 @@ describeFunctions(const char *pattern, bool verbose) "\n LEFT JOIN pg_catalog.pg_user u ON u.usesysid = p.proowner\n"); /* - * we skip in/out funcs by excluding functions that take some - * arguments, but have no types defined for those arguments + * we skip in/out funcs by excluding functions that take or return cstring */ appendPQExpBuffer(&buf, - "WHERE p.prorettype <> 0\n" - " AND (p.pronargs = 0 OR pg_catalog.oidvectortypes(p.proargtypes) <> '')\n" + "WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype\n" + " AND p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype\n" " AND NOT p.proisagg\n"); processNamePattern(&buf, pattern, true, false, @@ -436,7 +436,10 @@ objectDescription(const char *pattern) " CAST('%s' AS pg_catalog.text) as object\n" " FROM pg_catalog.pg_proc p\n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n" - " WHERE (p.pronargs = 0 or pg_catalog.oidvectortypes(p.proargtypes) <> '') AND NOT p.proisagg\n", + + " WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype\n" + " AND p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype\n" + " AND NOT p.proisagg\n", _("function")); processNamePattern(&buf, pattern, true, false, "n.nspname", "p.proname", NULL, diff --git a/src/bin/scripts/createlang.sh b/src/bin/scripts/createlang.sh index d7a9e98064f59cc219a3dab1bf4e0f8d7f9fdcf1..3f0009224d2b9596dc1f9ba9841d44bf132573d6 100644 --- a/src/bin/scripts/createlang.sh +++ b/src/bin/scripts/createlang.sh @@ -7,7 +7,7 @@ # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group # Portions Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.37 2002/08/10 16:57:32 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.38 2002/08/22 00:01:47 tgl Exp $ # #------------------------------------------------------------------------- @@ -270,7 +270,7 @@ fi # Create the call handler and the language # ---------- if [ "$handlerexists" = no ]; then - sqlcmd="CREATE FUNCTION \"$handler\" () RETURNS OPAQUE AS '$PGLIB/${object}' LANGUAGE C;" + sqlcmd="CREATE FUNCTION \"$handler\" () RETURNS LANGUAGE_HANDLER AS '$PGLIB/${object}' LANGUAGE C;" if [ "$showsql" = yes ]; then echo "$sqlcmd" fi diff --git a/src/include/access/printtup.h b/src/include/access/printtup.h index 48c605df744f49e574b60f00ef626b402d44f3aa..8eed08bc1bf7a261cc1924e9ffeb31007ac1223f 100644 --- a/src/include/access/printtup.h +++ b/src/include/access/printtup.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: printtup.h,v 1.20 2002/06/20 20:29:43 momjian Exp $ + * $Id: printtup.h,v 1.21 2002/08/22 00:01:47 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,7 +27,4 @@ extern void debugtup(HeapTuple tuple, TupleDesc typeinfo, extern void spi_printtup(HeapTuple tuple, TupleDesc tupdesc, DestReceiver *self); -extern bool getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem, - bool *typIsVarlena); - #endif /* PRINTTUP_H */ diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 979bc6ed033bd37dd9addd4665350d5160255056..2eba70c5fd231928197131b36b8b5d230e924514 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: catversion.h,v 1.150 2002/08/17 13:04:15 momjian Exp $ + * $Id: catversion.h,v 1.151 2002/08/22 00:01:47 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200208171 +#define CATALOG_VERSION_NO 200208201 #endif diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 6bb82f6a34eca6713e9b27c00bbb742ee7973cb9..a9fe521845d21364aa868be55865a6cfb1afede7 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_proc.h,v 1.259 2002/08/20 19:23:07 tgl Exp $ + * $Id: pg_proc.h,v 1.260 2002/08/22 00:01:47 tgl Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -93,57 +93,57 @@ typedef FormData_pg_proc *Form_pg_proc; /* OIDS 1 - 99 */ -DATA(insert OID = 1242 ( boolin PGNSP PGUID 12 f f t f i 1 16 "0" boolin - _null_ )); +DATA(insert OID = 1242 ( boolin PGNSP PGUID 12 f f t f i 1 16 "2275" boolin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1243 ( boolout PGNSP PGUID 12 f f t f i 1 23 "0" boolout - _null_ )); +DATA(insert OID = 1243 ( boolout PGNSP PGUID 12 f f t f i 1 2275 "16" boolout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1244 ( byteain PGNSP PGUID 12 f f t f i 1 17 "0" byteain - _null_ )); +DATA(insert OID = 1244 ( byteain PGNSP PGUID 12 f f t f i 1 17 "2275" byteain - _null_ )); DESCR("(internal)"); -DATA(insert OID = 31 ( byteaout PGNSP PGUID 12 f f t f i 1 23 "0" byteaout - _null_ )); +DATA(insert OID = 31 ( byteaout PGNSP PGUID 12 f f t f i 1 2275 "17" byteaout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1245 ( charin PGNSP PGUID 12 f f t f i 1 18 "0" charin - _null_ )); +DATA(insert OID = 1245 ( charin PGNSP PGUID 12 f f t f i 1 18 "2275" charin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 33 ( charout PGNSP PGUID 12 f f t f i 1 23 "0" charout - _null_ )); +DATA(insert OID = 33 ( charout PGNSP PGUID 12 f f t f i 1 2275 "18" charout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 34 ( namein PGNSP PGUID 12 f f t f i 1 19 "0" namein - _null_ )); +DATA(insert OID = 34 ( namein PGNSP PGUID 12 f f t f i 1 19 "2275" namein - _null_ )); DESCR("(internal)"); -DATA(insert OID = 35 ( nameout PGNSP PGUID 12 f f t f i 1 23 "0" nameout - _null_ )); +DATA(insert OID = 35 ( nameout PGNSP PGUID 12 f f t f i 1 2275 "19" nameout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 38 ( int2in PGNSP PGUID 12 f f t f i 1 21 "0" int2in - _null_ )); +DATA(insert OID = 38 ( int2in PGNSP PGUID 12 f f t f i 1 21 "2275" int2in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 39 ( int2out PGNSP PGUID 12 f f t f i 1 23 "0" int2out - _null_ )); +DATA(insert OID = 39 ( int2out PGNSP PGUID 12 f f t f i 1 2275 "21" int2out - _null_ )); DESCR("(internal)"); -DATA(insert OID = 40 ( int2vectorin PGNSP PGUID 12 f f t f i 1 22 "0" int2vectorin - _null_ )); +DATA(insert OID = 40 ( int2vectorin PGNSP PGUID 12 f f t f i 1 22 "2275" int2vectorin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 41 ( int2vectorout PGNSP PGUID 12 f f t f i 1 23 "0" int2vectorout - _null_ )); +DATA(insert OID = 41 ( int2vectorout PGNSP PGUID 12 f f t f i 1 2275 "22" int2vectorout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 42 ( int4in PGNSP PGUID 12 f f t f i 1 23 "0" int4in - _null_ )); +DATA(insert OID = 42 ( int4in PGNSP PGUID 12 f f t f i 1 23 "2275" int4in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 43 ( int4out PGNSP PGUID 12 f f t f i 1 23 "0" int4out - _null_ )); +DATA(insert OID = 43 ( int4out PGNSP PGUID 12 f f t f i 1 2275 "23" int4out - _null_ )); DESCR("(internal)"); -DATA(insert OID = 44 ( regprocin PGNSP PGUID 12 f f t f s 1 24 "0" regprocin - _null_ )); +DATA(insert OID = 44 ( regprocin PGNSP PGUID 12 f f t f s 1 24 "2275" regprocin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 45 ( regprocout PGNSP PGUID 12 f f t f s 1 23 "0" regprocout - _null_ )); +DATA(insert OID = 45 ( regprocout PGNSP PGUID 12 f f t f s 1 2275 "24" regprocout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 46 ( textin PGNSP PGUID 12 f f t f i 1 25 "0" textin - _null_ )); +DATA(insert OID = 46 ( textin PGNSP PGUID 12 f f t f i 1 25 "2275" textin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 47 ( textout PGNSP PGUID 12 f f t f i 1 23 "0" textout - _null_ )); +DATA(insert OID = 47 ( textout PGNSP PGUID 12 f f t f i 1 2275 "25" textout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 48 ( tidin PGNSP PGUID 12 f f t f i 1 27 "0" tidin - _null_ )); +DATA(insert OID = 48 ( tidin PGNSP PGUID 12 f f t f i 1 27 "2275" tidin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 49 ( tidout PGNSP PGUID 12 f f t f i 1 23 "0" tidout - _null_ )); +DATA(insert OID = 49 ( tidout PGNSP PGUID 12 f f t f i 1 2275 "27" tidout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 50 ( xidin PGNSP PGUID 12 f f t f i 1 28 "0" xidin - _null_ )); +DATA(insert OID = 50 ( xidin PGNSP PGUID 12 f f t f i 1 28 "2275" xidin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 51 ( xidout PGNSP PGUID 12 f f t f i 1 23 "0" xidout - _null_ )); +DATA(insert OID = 51 ( xidout PGNSP PGUID 12 f f t f i 1 2275 "28" xidout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 52 ( cidin PGNSP PGUID 12 f f t f i 1 29 "0" cidin - _null_ )); +DATA(insert OID = 52 ( cidin PGNSP PGUID 12 f f t f i 1 29 "2275" cidin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 53 ( cidout PGNSP PGUID 12 f f t f i 1 23 "0" cidout - _null_ )); +DATA(insert OID = 53 ( cidout PGNSP PGUID 12 f f t f i 1 2275 "29" cidout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 54 ( oidvectorin PGNSP PGUID 12 f f t f i 1 30 "0" oidvectorin - _null_ )); +DATA(insert OID = 54 ( oidvectorin PGNSP PGUID 12 f f t f i 1 30 "2275" oidvectorin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 55 ( oidvectorout PGNSP PGUID 12 f f t f i 1 23 "0" oidvectorout - _null_ )); +DATA(insert OID = 55 ( oidvectorout PGNSP PGUID 12 f f t f i 1 2275 "30" oidvectorout - _null_ )); DESCR("(internal)"); DATA(insert OID = 56 ( boollt PGNSP PGUID 12 f f t f i 2 16 "16 16" boollt - _null_ )); DESCR("less-than"); @@ -210,26 +210,26 @@ DESCR("PostgreSQL version string"); DATA(insert OID = 100 ( int8fac PGNSP PGUID 12 f f t f i 1 20 "20" int8fac - _null_ )); DESCR("factorial"); -DATA(insert OID = 101 ( eqsel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" eqsel - _null_ )); +DATA(insert OID = 101 ( eqsel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" eqsel - _null_ )); DESCR("restriction selectivity of = and related operators"); -DATA(insert OID = 102 ( neqsel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" neqsel - _null_ )); +DATA(insert OID = 102 ( neqsel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" neqsel - _null_ )); DESCR("restriction selectivity of <> and related operators"); -DATA(insert OID = 103 ( scalarltsel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" scalarltsel - _null_ )); +DATA(insert OID = 103 ( scalarltsel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" scalarltsel - _null_ )); DESCR("restriction selectivity of < and related operators on scalar datatypes"); -DATA(insert OID = 104 ( scalargtsel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" scalargtsel - _null_ )); +DATA(insert OID = 104 ( scalargtsel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" scalargtsel - _null_ )); DESCR("restriction selectivity of > and related operators on scalar datatypes"); -DATA(insert OID = 105 ( eqjoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" eqjoinsel - _null_ )); +DATA(insert OID = 105 ( eqjoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" eqjoinsel - _null_ )); DESCR("join selectivity of = and related operators"); -DATA(insert OID = 106 ( neqjoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" neqjoinsel - _null_ )); +DATA(insert OID = 106 ( neqjoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" neqjoinsel - _null_ )); DESCR("join selectivity of <> and related operators"); -DATA(insert OID = 107 ( scalarltjoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" scalarltjoinsel - _null_ )); +DATA(insert OID = 107 ( scalarltjoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" scalarltjoinsel - _null_ )); DESCR("join selectivity of < and related operators on scalar datatypes"); -DATA(insert OID = 108 ( scalargtjoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" scalargtjoinsel - _null_ )); +DATA(insert OID = 108 ( scalargtjoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" scalargtjoinsel - _null_ )); DESCR("join selectivity of > and related operators on scalar datatypes"); -DATA(insert OID = 109 ( unknownin PGNSP PGUID 12 f f t f i 1 705 "0" unknownin - _null_ )); +DATA(insert OID = 109 ( unknownin PGNSP PGUID 12 f f t f i 1 705 "2275" unknownin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 110 ( unknownout PGNSP PGUID 12 f f t f i 1 23 "0" unknownout - _null_ )); +DATA(insert OID = 110 ( unknownout PGNSP PGUID 12 f f t f i 1 2275 "705" unknownout - _null_ )); DESCR("(internal)"); DATA(insert OID = 112 ( text PGNSP PGUID 12 f f t f i 1 25 "23" int4_text - _null_ )); @@ -244,21 +244,21 @@ DESCR("is above"); DATA(insert OID = 116 ( box_below PGNSP PGUID 12 f f t f i 2 16 "603 603" box_below - _null_ )); DESCR("is below"); -DATA(insert OID = 117 ( point_in PGNSP PGUID 12 f f t f i 1 600 "0" point_in - _null_ )); +DATA(insert OID = 117 ( point_in PGNSP PGUID 12 f f t f i 1 600 "2275" point_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 118 ( point_out PGNSP PGUID 12 f f t f i 1 23 "600" point_out - _null_ )); +DATA(insert OID = 118 ( point_out PGNSP PGUID 12 f f t f i 1 2275 "600" point_out - _null_ )); DESCR("(internal)"); -DATA(insert OID = 119 ( lseg_in PGNSP PGUID 12 f f t f i 1 601 "0" lseg_in - _null_ )); +DATA(insert OID = 119 ( lseg_in PGNSP PGUID 12 f f t f i 1 601 "2275" lseg_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 120 ( lseg_out PGNSP PGUID 12 f f t f i 1 23 "0" lseg_out - _null_ )); +DATA(insert OID = 120 ( lseg_out PGNSP PGUID 12 f f t f i 1 2275 "601" lseg_out - _null_ )); DESCR("(internal)"); -DATA(insert OID = 121 ( path_in PGNSP PGUID 12 f f t f i 1 602 "0" path_in - _null_ )); +DATA(insert OID = 121 ( path_in PGNSP PGUID 12 f f t f i 1 602 "2275" path_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 122 ( path_out PGNSP PGUID 12 f f t f i 1 23 "0" path_out - _null_ )); +DATA(insert OID = 122 ( path_out PGNSP PGUID 12 f f t f i 1 2275 "602" path_out - _null_ )); DESCR("(internal)"); -DATA(insert OID = 123 ( box_in PGNSP PGUID 12 f f t f i 1 603 "0" box_in - _null_ )); +DATA(insert OID = 123 ( box_in PGNSP PGUID 12 f f t f i 1 603 "2275" box_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 124 ( box_out PGNSP PGUID 12 f f t f i 1 23 "0" box_out - _null_ )); +DATA(insert OID = 124 ( box_out PGNSP PGUID 12 f f t f i 1 2275 "603" box_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 125 ( box_overlap PGNSP PGUID 12 f f t f i 2 16 "603 603" box_overlap - _null_ )); DESCR("overlaps"); @@ -288,9 +288,9 @@ DATA(insert OID = 137 ( on_ppath PGNSP PGUID 12 f f t f i 2 16 "600 602" o DESCR("contained in"); DATA(insert OID = 138 ( box_center PGNSP PGUID 12 f f t f i 1 600 "603" box_center - _null_ )); DESCR("center of"); -DATA(insert OID = 139 ( areasel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" areasel - _null_ )); +DATA(insert OID = 139 ( areasel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" areasel - _null_ )); DESCR("restriction selectivity for area-comparison operators"); -DATA(insert OID = 140 ( areajoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" areajoinsel - _null_ )); +DATA(insert OID = 140 ( areajoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" areajoinsel - _null_ )); DESCR("join selectivity for area-comparison operators"); DATA(insert OID = 141 ( int4mul PGNSP PGUID 12 f f t f i 2 23 "23 23" int4mul - _null_ )); DESCR("multiply"); @@ -411,9 +411,9 @@ DESCR("r-tree"); /* OIDS 200 - 299 */ -DATA(insert OID = 200 ( float4in PGNSP PGUID 12 f f t f i 1 700 "0" float4in - _null_ )); +DATA(insert OID = 200 ( float4in PGNSP PGUID 12 f f t f i 1 700 "2275" float4in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 201 ( float4out PGNSP PGUID 12 f f t f i 1 23 "700" float4out - _null_ )); +DATA(insert OID = 201 ( float4out PGNSP PGUID 12 f f t f i 1 2275 "700" float4out - _null_ )); DESCR("(internal)"); DATA(insert OID = 202 ( float4mul PGNSP PGUID 12 f f t f i 2 700 "700 700" float4mul - _null_ )); DESCR("multiply"); @@ -439,9 +439,9 @@ DESCR("negate"); DATA(insert OID = 213 ( int2um PGNSP PGUID 12 f f t f i 1 21 "21" int2um - _null_ )); DESCR("negate"); -DATA(insert OID = 214 ( float8in PGNSP PGUID 12 f f t f i 1 701 "0" float8in - _null_ )); +DATA(insert OID = 214 ( float8in PGNSP PGUID 12 f f t f i 1 701 "2275" float8in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 215 ( float8out PGNSP PGUID 12 f f t f i 1 23 "701" float8out - _null_ )); +DATA(insert OID = 215 ( float8out PGNSP PGUID 12 f f t f i 1 2275 "701" float8out - _null_ )); DESCR("(internal)"); DATA(insert OID = 216 ( float8mul PGNSP PGUID 12 f f t f i 2 701 "701 701" float8mul - _null_ )); DESCR("multiply"); @@ -494,27 +494,27 @@ DESCR("convert float4 to int2"); DATA(insert OID = 239 ( line_distance PGNSP PGUID 12 f f t f i 2 701 "628 628" line_distance - _null_ )); DESCR("distance between"); -DATA(insert OID = 240 ( nabstimein PGNSP PGUID 12 f f t f s 1 702 "0" nabstimein - _null_ )); +DATA(insert OID = 240 ( nabstimein PGNSP PGUID 12 f f t f s 1 702 "2275" nabstimein - _null_ )); DESCR("(internal)"); -DATA(insert OID = 241 ( nabstimeout PGNSP PGUID 12 f f t f s 1 23 "0" nabstimeout - _null_ )); +DATA(insert OID = 241 ( nabstimeout PGNSP PGUID 12 f f t f s 1 2275 "702" nabstimeout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 242 ( reltimein PGNSP PGUID 12 f f t f s 1 703 "0" reltimein - _null_ )); +DATA(insert OID = 242 ( reltimein PGNSP PGUID 12 f f t f s 1 703 "2275" reltimein - _null_ )); DESCR("(internal)"); -DATA(insert OID = 243 ( reltimeout PGNSP PGUID 12 f f t f s 1 23 "0" reltimeout - _null_ )); +DATA(insert OID = 243 ( reltimeout PGNSP PGUID 12 f f t f s 1 2275 "703" reltimeout - _null_ )); DESCR("(internal)"); DATA(insert OID = 244 ( timepl PGNSP PGUID 12 f f t f i 2 702 "702 703" timepl - _null_ )); DESCR("add"); DATA(insert OID = 245 ( timemi PGNSP PGUID 12 f f t f i 2 702 "702 703" timemi - _null_ )); DESCR("subtract"); -DATA(insert OID = 246 ( tintervalin PGNSP PGUID 12 f f t f s 1 704 "0" tintervalin - _null_ )); +DATA(insert OID = 246 ( tintervalin PGNSP PGUID 12 f f t f s 1 704 "2275" tintervalin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 247 ( tintervalout PGNSP PGUID 12 f f t f s 1 23 "0" tintervalout - _null_ )); +DATA(insert OID = 247 ( tintervalout PGNSP PGUID 12 f f t f s 1 2275 "704" tintervalout - _null_ )); DESCR("(internal)"); DATA(insert OID = 248 ( intinterval PGNSP PGUID 12 f f t f i 2 16 "702 704" intinterval - _null_ )); DESCR("abstime in tinterval"); DATA(insert OID = 249 ( tintervalrel PGNSP PGUID 12 f f t f i 1 703 "704" tintervalrel - _null_ )); DESCR(""); -DATA(insert OID = 250 ( timenow PGNSP PGUID 12 f f t f s 0 702 "0" timenow - _null_ )); +DATA(insert OID = 250 ( timenow PGNSP PGUID 12 f f t f s 0 702 "" timenow - _null_ )); DESCR("Current date and time (abstime)"); DATA(insert OID = 251 ( abstimeeq PGNSP PGUID 12 f f t f i 2 16 "702 702" abstimeeq - _null_ )); DESCR("equal"); @@ -562,7 +562,7 @@ DATA(insert OID = 272 ( tintervalstart PGNSP PGUID 12 f f t f i 1 702 "704" DESCR("start of interval"); DATA(insert OID = 273 ( tintervalend PGNSP PGUID 12 f f t f i 1 702 "704" tintervalend - _null_ )); DESCR(""); -DATA(insert OID = 274 ( timeofday PGNSP PGUID 12 f f t f v 0 25 "0" timeofday - _null_ )); +DATA(insert OID = 274 ( timeofday PGNSP PGUID 12 f f t f v 0 25 "" timeofday - _null_ )); DESCR("Current date and time - increments during transactions"); DATA(insert OID = 275 ( isfinite PGNSP PGUID 12 f f t f i 1 16 "702" abstime_finite - _null_ )); DESCR(""); @@ -665,46 +665,46 @@ DESCR("convert int4 to float4"); DATA(insert OID = 319 ( int4 PGNSP PGUID 12 f f t f i 1 23 "700" ftoi4 - _null_ )); DESCR("convert float4 to int4"); -DATA(insert OID = 320 ( rtinsert PGNSP PGUID 12 f f t f v 6 23 "0 0 0 0 0 0" rtinsert - _null_ )); +DATA(insert OID = 320 ( rtinsert PGNSP PGUID 12 f f t f v 6 23 "2281 2281 2281 2281 2281 2281" rtinsert - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 322 ( rtgettuple PGNSP PGUID 12 f f t f v 2 23 "0 0" rtgettuple - _null_ )); +DATA(insert OID = 322 ( rtgettuple PGNSP PGUID 12 f f t f v 2 23 "2281 2281" rtgettuple - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 323 ( rtbuild PGNSP PGUID 12 f f t f v 3 23 "0 0 0" rtbuild - _null_ )); +DATA(insert OID = 323 ( rtbuild PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" rtbuild - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 324 ( rtbeginscan PGNSP PGUID 12 f f t f v 3 23 "0 0 0" rtbeginscan - _null_ )); +DATA(insert OID = 324 ( rtbeginscan PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" rtbeginscan - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 325 ( rtendscan PGNSP PGUID 12 f f t f v 1 23 "0" rtendscan - _null_ )); +DATA(insert OID = 325 ( rtendscan PGNSP PGUID 12 f f t f v 1 23 "2281" rtendscan - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 326 ( rtmarkpos PGNSP PGUID 12 f f t f v 1 23 "0" rtmarkpos - _null_ )); +DATA(insert OID = 326 ( rtmarkpos PGNSP PGUID 12 f f t f v 1 23 "2281" rtmarkpos - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 327 ( rtrestrpos PGNSP PGUID 12 f f t f v 1 23 "0" rtrestrpos - _null_ )); +DATA(insert OID = 327 ( rtrestrpos PGNSP PGUID 12 f f t f v 1 23 "2281" rtrestrpos - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 328 ( rtrescan PGNSP PGUID 12 f f t f v 2 23 "0 0" rtrescan - _null_ )); +DATA(insert OID = 328 ( rtrescan PGNSP PGUID 12 f f t f v 2 23 "2281 2281" rtrescan - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 321 ( rtbulkdelete PGNSP PGUID 12 f f t f v 3 23 "0 0 0" rtbulkdelete - _null_ )); +DATA(insert OID = 321 ( rtbulkdelete PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" rtbulkdelete - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 1265 ( rtcostestimate PGNSP PGUID 12 f f t f v 8 0 "0 0 0 0 0 0 0 0" rtcostestimate - _null_ )); +DATA(insert OID = 1265 ( rtcostestimate PGNSP PGUID 12 f f t f v 8 2278 "2281 2281 2281 2281 2281 2281 2281 2281" rtcostestimate - _null_ )); DESCR("r-tree(internal)"); -DATA(insert OID = 330 ( btgettuple PGNSP PGUID 12 f f t f v 2 23 "0 0" btgettuple - _null_ )); +DATA(insert OID = 330 ( btgettuple PGNSP PGUID 12 f f t f v 2 23 "2281 2281" btgettuple - _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 331 ( btinsert PGNSP PGUID 12 f f t f v 6 23 "0 0 0 0 0 0" btinsert - _null_ )); +DATA(insert OID = 331 ( btinsert PGNSP PGUID 12 f f t f v 6 23 "2281 2281 2281 2281 2281 2281" btinsert - _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 333 ( btbeginscan PGNSP PGUID 12 f f t f v 3 23 "0 0 0" btbeginscan - _null_ )); +DATA(insert OID = 333 ( btbeginscan PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" btbeginscan - _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 334 ( btrescan PGNSP PGUID 12 f f t f v 2 23 "0 0" btrescan - _null_ )); +DATA(insert OID = 334 ( btrescan PGNSP PGUID 12 f f t f v 2 23 "2281 2281" btrescan - _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 335 ( btendscan PGNSP PGUID 12 f f t f v 1 23 "0" btendscan - _null_ )); +DATA(insert OID = 335 ( btendscan PGNSP PGUID 12 f f t f v 1 23 "2281" btendscan - _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 336 ( btmarkpos PGNSP PGUID 12 f f t f v 1 23 "0" btmarkpos - _null_ )); +DATA(insert OID = 336 ( btmarkpos PGNSP PGUID 12 f f t f v 1 23 "2281" btmarkpos - _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 337 ( btrestrpos PGNSP PGUID 12 f f t f v 1 23 "0" btrestrpos - _null_ )); +DATA(insert OID = 337 ( btrestrpos PGNSP PGUID 12 f f t f v 1 23 "2281" btrestrpos - _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 338 ( btbuild PGNSP PGUID 12 f f t f v 3 23 "0 0 0" btbuild - _null_ )); +DATA(insert OID = 338 ( btbuild PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" btbuild - _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 332 ( btbulkdelete PGNSP PGUID 12 f f t f v 3 23 "0 0 0" btbulkdelete - _null_ )); +DATA(insert OID = 332 ( btbulkdelete PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" btbulkdelete - _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 1268 ( btcostestimate PGNSP PGUID 12 f f t f v 8 0 "0 0 0 0 0 0 0 0" btcostestimate - _null_ )); +DATA(insert OID = 1268 ( btcostestimate PGNSP PGUID 12 f f t f v 8 2278 "2281 2281 2281 2281 2281 2281 2281 2281" btcostestimate - _null_ )); DESCR("btree(internal)"); DATA(insert OID = 339 ( poly_same PGNSP PGUID 12 f f t f i 2 16 "604 604" poly_same - _null_ )); @@ -723,9 +723,9 @@ DATA(insert OID = 345 ( poly_contained PGNSP PGUID 12 f f t f i 2 16 "604 60 DESCR("contained in"); DATA(insert OID = 346 ( poly_overlap PGNSP PGUID 12 f f t f i 2 16 "604 604" poly_overlap - _null_ )); DESCR("overlaps"); -DATA(insert OID = 347 ( poly_in PGNSP PGUID 12 f f t f i 1 604 "0" poly_in - _null_ )); +DATA(insert OID = 347 ( poly_in PGNSP PGUID 12 f f t f i 1 604 "2275" poly_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 348 ( poly_out PGNSP PGUID 12 f f t f i 1 23 "0" poly_out - _null_ )); +DATA(insert OID = 348 ( poly_out PGNSP PGUID 12 f f t f i 1 2275 "604" poly_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 350 ( btint2cmp PGNSP PGUID 12 f f t f i 2 23 "21 21" btint2cmp - _null_ )); @@ -789,25 +789,25 @@ DESCR("convert name to char()"); DATA(insert OID = 409 ( name PGNSP PGUID 12 f f t f i 1 19 "1042" bpchar_name - _null_ )); DESCR("convert char() to name"); -DATA(insert OID = 440 ( hashgettuple PGNSP PGUID 12 f f t f v 2 23 "0 0" hashgettuple - _null_ )); +DATA(insert OID = 440 ( hashgettuple PGNSP PGUID 12 f f t f v 2 23 "2281 2281" hashgettuple - _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 441 ( hashinsert PGNSP PGUID 12 f f t f v 6 23 "0 0 0 0 0 0" hashinsert - _null_ )); +DATA(insert OID = 441 ( hashinsert PGNSP PGUID 12 f f t f v 6 23 "2281 2281 2281 2281 2281 2281" hashinsert - _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 443 ( hashbeginscan PGNSP PGUID 12 f f t f v 3 23 "0 0 0" hashbeginscan - _null_ )); +DATA(insert OID = 443 ( hashbeginscan PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" hashbeginscan - _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 444 ( hashrescan PGNSP PGUID 12 f f t f v 2 23 "0 0" hashrescan - _null_ )); +DATA(insert OID = 444 ( hashrescan PGNSP PGUID 12 f f t f v 2 23 "2281 2281" hashrescan - _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 445 ( hashendscan PGNSP PGUID 12 f f t f v 1 23 "0" hashendscan - _null_ )); +DATA(insert OID = 445 ( hashendscan PGNSP PGUID 12 f f t f v 1 23 "2281" hashendscan - _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 446 ( hashmarkpos PGNSP PGUID 12 f f t f v 1 23 "0" hashmarkpos - _null_ )); +DATA(insert OID = 446 ( hashmarkpos PGNSP PGUID 12 f f t f v 1 23 "2281" hashmarkpos - _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 447 ( hashrestrpos PGNSP PGUID 12 f f t f v 1 23 "0" hashrestrpos - _null_ )); +DATA(insert OID = 447 ( hashrestrpos PGNSP PGUID 12 f f t f v 1 23 "2281" hashrestrpos - _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 448 ( hashbuild PGNSP PGUID 12 f f t f v 3 23 "0 0 0" hashbuild - _null_ )); +DATA(insert OID = 448 ( hashbuild PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" hashbuild - _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 442 ( hashbulkdelete PGNSP PGUID 12 f f t f v 3 23 "0 0 0" hashbulkdelete - _null_ )); +DATA(insert OID = 442 ( hashbulkdelete PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" hashbulkdelete - _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 438 ( hashcostestimate PGNSP PGUID 12 f f t f v 8 0 "0 0 0 0 0 0 0 0" hashcostestimate - _null_ )); +DATA(insert OID = 438 ( hashcostestimate PGNSP PGUID 12 f f t f v 8 2278 "2281 2281 2281 2281 2281 2281 2281 2281" hashcostestimate - _null_ )); DESCR("hash(internal)"); DATA(insert OID = 449 ( hashint2 PGNSP PGUID 12 f f t f i 1 23 "21" hashint2 - _null_ )); @@ -826,7 +826,7 @@ DATA(insert OID = 454 ( hashchar PGNSP PGUID 12 f f t f i 1 23 "18" hashch DESCR("hash"); DATA(insert OID = 455 ( hashname PGNSP PGUID 12 f f t f i 1 23 "19" hashname - _null_ )); DESCR("hash"); -DATA(insert OID = 456 ( hashvarlena PGNSP PGUID 12 f f t f i 1 23 "0" hashvarlena - _null_ )); +DATA(insert OID = 456 ( hashvarlena PGNSP PGUID 12 f f t f i 1 23 "2281" hashvarlena - _null_ )); DESCR("hash any varlena type"); DATA(insert OID = 457 ( hashoidvector PGNSP PGUID 12 f f t f i 1 23 "30" hashoidvector - _null_ )); DESCR("hash"); @@ -837,9 +837,9 @@ DESCR("larger of two"); DATA(insert OID = 459 ( text_smaller PGNSP PGUID 12 f f t f i 2 25 "25 25" text_smaller - _null_ )); DESCR("smaller of two"); -DATA(insert OID = 460 ( int8in PGNSP PGUID 12 f f t f i 1 20 "0" int8in - _null_ )); +DATA(insert OID = 460 ( int8in PGNSP PGUID 12 f f t f i 1 20 "2275" int8in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 461 ( int8out PGNSP PGUID 12 f f t f i 1 23 "0" int8out - _null_ )); +DATA(insert OID = 461 ( int8out PGNSP PGUID 12 f f t f i 1 2275 "20" int8out - _null_ )); DESCR("(internal)"); DATA(insert OID = 462 ( int8um PGNSP PGUID 12 f f t f i 1 20 "20" int8um - _null_ )); DESCR("negate"); @@ -899,10 +899,6 @@ DATA(insert OID = 1285 ( int4notin PGNSP PGUID 12 f f t f s 2 16 "23 25" in DESCR("not in"); DATA(insert OID = 1286 ( oidnotin PGNSP PGUID 12 f f t f s 2 16 "26 25" oidnotin - _null_ )); DESCR("not in"); -DATA(insert OID = 1287 ( int44in PGNSP PGUID 12 f f t f i 1 22 "0" int44in - _null_ )); -DESCR("(internal)"); -DATA(insert OID = 653 ( int44out PGNSP PGUID 12 f f t f i 1 23 "0" int44out - _null_ )); -DESCR("(internal)"); DATA(insert OID = 655 ( namelt PGNSP PGUID 12 f f t f i 2 16 "19 19" namelt - _null_ )); DESCR("less-than"); DATA(insert OID = 656 ( namele PGNSP PGUID 12 f f t f i 2 16 "19 19" namele - _null_ )); @@ -935,7 +931,7 @@ DATA(insert OID = 681 ( oidvectorgt PGNSP PGUID 12 f f t f i 2 16 "30 30" oi DESCR("greater-than"); /* OIDS 700 - 799 */ -DATA(insert OID = 710 ( getpgusername PGNSP PGUID 12 f f t f s 0 19 "0" current_user - _null_ )); +DATA(insert OID = 710 ( getpgusername PGNSP PGUID 12 f f t f s 0 19 "" current_user - _null_ )); DESCR("deprecated -- use current_user"); DATA(insert OID = 711 ( userfntest PGNSP PGUID 12 f f t f i 1 23 "23" userfntest - _null_ )); DESCR(""); @@ -979,24 +975,24 @@ DESCR("greater-than"); DATA(insert OID = 743 ( text_ge PGNSP PGUID 12 f f t f i 2 16 "25 25" text_ge - _null_ )); DESCR("greater-than-or-equal"); -DATA(insert OID = 744 ( array_eq PGNSP PGUID 12 f f t f i 2 16 "0 0" array_eq - _null_ )); +DATA(insert OID = 744 ( array_eq PGNSP PGUID 12 f f t f i 2 16 "2277 2277" array_eq - _null_ )); DESCR("array equal"); -DATA(insert OID = 745 ( current_user PGNSP PGUID 12 f f t f s 0 19 "0" current_user - _null_ )); +DATA(insert OID = 745 ( current_user PGNSP PGUID 12 f f t f s 0 19 "" current_user - _null_ )); DESCR("current user name"); -DATA(insert OID = 746 ( session_user PGNSP PGUID 12 f f t f s 0 19 "0" session_user - _null_ )); +DATA(insert OID = 746 ( session_user PGNSP PGUID 12 f f t f s 0 19 "" session_user - _null_ )); DESCR("session user name"); -DATA(insert OID = 747 ( array_dims PGNSP PGUID 12 f f t f i 1 25 "0" array_dims - _null_ )); +DATA(insert OID = 747 ( array_dims PGNSP PGUID 12 f f t f i 1 25 "2277" array_dims - _null_ )); DESCR("array dimensions"); -DATA(insert OID = 750 ( array_in PGNSP PGUID 12 f f t f i 3 23 "0 26 23" array_in - _null_ )); +DATA(insert OID = 750 ( array_in PGNSP PGUID 12 f f t f i 3 2277 "2275 26 23" array_in - _null_ )); DESCR("array"); -DATA(insert OID = 751 ( array_out PGNSP PGUID 12 f f t f i 2 23 "0 26" array_out - _null_ )); +DATA(insert OID = 751 ( array_out PGNSP PGUID 12 f f t f i 2 2275 "2281 26" array_out - _null_ )); DESCR("array"); -DATA(insert OID = 760 ( smgrin PGNSP PGUID 12 f f t f s 1 210 "0" smgrin - _null_ )); +DATA(insert OID = 760 ( smgrin PGNSP PGUID 12 f f t f s 1 210 "2275" smgrin - _null_ )); DESCR("storage manager(internal)"); -DATA(insert OID = 761 ( smgrout PGNSP PGUID 12 f f t f s 1 23 "0" smgrout - _null_ )); +DATA(insert OID = 761 ( smgrout PGNSP PGUID 12 f f t f s 1 2275 "210" smgrout - _null_ )); DESCR("storage manager(internal)"); DATA(insert OID = 762 ( smgreq PGNSP PGUID 12 f f t f i 2 16 "210 210" smgreq - _null_ )); DESCR("storage manager"); @@ -1019,25 +1015,25 @@ DESCR("larger of two"); DATA(insert OID = 771 ( int2smaller PGNSP PGUID 12 f f t f i 2 21 "21 21" int2smaller - _null_ )); DESCR("smaller of two"); -DATA(insert OID = 774 ( gistgettuple PGNSP PGUID 12 f f t f v 2 23 "0 0" gistgettuple - _null_ )); +DATA(insert OID = 774 ( gistgettuple PGNSP PGUID 12 f f t f v 2 23 "2281 2281" gistgettuple - _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 775 ( gistinsert PGNSP PGUID 12 f f t f v 6 23 "0 0 0 0 0 0" gistinsert - _null_ )); +DATA(insert OID = 775 ( gistinsert PGNSP PGUID 12 f f t f v 6 23 "2281 2281 2281 2281 2281 2281" gistinsert - _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 777 ( gistbeginscan PGNSP PGUID 12 f f t f v 3 23 "0 0 0" gistbeginscan - _null_ )); +DATA(insert OID = 777 ( gistbeginscan PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" gistbeginscan - _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 778 ( gistrescan PGNSP PGUID 12 f f t f v 2 23 "0 0" gistrescan - _null_ )); +DATA(insert OID = 778 ( gistrescan PGNSP PGUID 12 f f t f v 2 23 "2281 2281" gistrescan - _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 779 ( gistendscan PGNSP PGUID 12 f f t f v 1 23 "0" gistendscan - _null_ )); +DATA(insert OID = 779 ( gistendscan PGNSP PGUID 12 f f t f v 1 23 "2281" gistendscan - _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 780 ( gistmarkpos PGNSP PGUID 12 f f t f v 1 23 "0" gistmarkpos - _null_ )); +DATA(insert OID = 780 ( gistmarkpos PGNSP PGUID 12 f f t f v 1 23 "2281" gistmarkpos - _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 781 ( gistrestrpos PGNSP PGUID 12 f f t f v 1 23 "0" gistrestrpos - _null_ )); +DATA(insert OID = 781 ( gistrestrpos PGNSP PGUID 12 f f t f v 1 23 "2281" gistrestrpos - _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 782 ( gistbuild PGNSP PGUID 12 f f t f v 3 23 "0 0 0" gistbuild - _null_ )); +DATA(insert OID = 782 ( gistbuild PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" gistbuild - _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 776 ( gistbulkdelete PGNSP PGUID 12 f f t f v 3 23 "0 0 0" gistbulkdelete - _null_ )); +DATA(insert OID = 776 ( gistbulkdelete PGNSP PGUID 12 f f t f v 3 23 "2281 2281 2281" gistbulkdelete - _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 772 ( gistcostestimate PGNSP PGUID 12 f f t f v 8 0 "0 0 0 0 0 0 0 0" gistcostestimate - _null_ )); +DATA(insert OID = 772 ( gistcostestimate PGNSP PGUID 12 f f t f v 8 2278 "2281 2281 2281 2281 2281 2281 2281 2281" gistcostestimate - _null_ )); DESCR("gist(internal)"); DATA(insert OID = 784 ( tintervaleq PGNSP PGUID 12 f f t f i 2 16 "704 704" tintervaleq - _null_ )); @@ -1106,7 +1102,7 @@ DESCR("does not match LIKE expression"); DATA(insert OID = 860 ( bpchar PGNSP PGUID 12 f f t f i 1 1042 "18" char_bpchar - _null_ )); DESCR("convert char to char()"); -DATA(insert OID = 861 ( current_database PGNSP PGUID 12 f f t f i 0 19 "0" current_database - _null_ )); +DATA(insert OID = 861 ( current_database PGNSP PGUID 12 f f t f i 0 19 "" current_database - _null_ )); DESCR("returns the current database"); DATA(insert OID = 862 ( int4_mul_cash PGNSP PGUID 12 f f t f i 2 790 "23 790" int4_mul_cash - _null_ )); @@ -1122,9 +1118,9 @@ DESCR("multiply"); DATA(insert OID = 867 ( cash_div_int2 PGNSP PGUID 12 f f t f i 2 790 "790 21" cash_div_int2 - _null_ )); DESCR("divide"); -DATA(insert OID = 886 ( cash_in PGNSP PGUID 12 f f t f i 1 790 "0" cash_in - _null_ )); +DATA(insert OID = 886 ( cash_in PGNSP PGUID 12 f f t f i 1 790 "2275" cash_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 887 ( cash_out PGNSP PGUID 12 f f t f i 1 23 "0" cash_out - _null_ )); +DATA(insert OID = 887 ( cash_out PGNSP PGUID 12 f f t f i 1 2275 "790" cash_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 888 ( cash_eq PGNSP PGUID 12 f f t f i 2 16 "790 790" cash_eq - _null_ )); DESCR("equal"); @@ -1279,13 +1275,13 @@ DESCR("convert timetz to text"); DATA(insert OID = 1026 ( timezone PGNSP PGUID 12 f f t f s 2 1186 "1186 1184" timestamptz_izone - _null_ )); DESCR("time zone"); -DATA(insert OID = 1029 ( nullvalue PGNSP PGUID 12 f f f f i 1 16 "0" nullvalue - _null_ )); +DATA(insert OID = 1029 ( nullvalue PGNSP PGUID 12 f f f f i 1 16 "2276" nullvalue - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1030 ( nonnullvalue PGNSP PGUID 12 f f f f i 1 16 "0" nonnullvalue - _null_ )); +DATA(insert OID = 1030 ( nonnullvalue PGNSP PGUID 12 f f f f i 1 16 "2276" nonnullvalue - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1031 ( aclitemin PGNSP PGUID 12 f f t f s 1 1033 "0" aclitemin - _null_ )); +DATA(insert OID = 1031 ( aclitemin PGNSP PGUID 12 f f t f s 1 1033 "2275" aclitemin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1032 ( aclitemout PGNSP PGUID 12 f f t f s 1 23 "1033" aclitemout - _null_ )); +DATA(insert OID = 1032 ( aclitemout PGNSP PGUID 12 f f t f s 1 2275 "1033" aclitemout - _null_ )); DESCR("(internal)"); DATA(insert OID = 1035 ( aclinsert PGNSP PGUID 12 f f t f s 2 1034 "1034 1033" aclinsert - _null_ )); DESCR("add/update ACL item"); @@ -1295,13 +1291,13 @@ DATA(insert OID = 1037 ( aclcontains PGNSP PGUID 12 f f t f s 2 16 "1034 103 DESCR("does ACL contain item?"); DATA(insert OID = 1038 ( seteval PGNSP PGUID 12 f f t t v 1 23 "26" seteval - _null_ )); DESCR("internal function supporting PostQuel-style sets"); -DATA(insert OID = 1044 ( bpcharin PGNSP PGUID 12 f f t f i 3 1042 "0 26 23" bpcharin - _null_ )); +DATA(insert OID = 1044 ( bpcharin PGNSP PGUID 12 f f t f i 3 1042 "2275 26 23" bpcharin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1045 ( bpcharout PGNSP PGUID 12 f f t f i 1 23 "0" bpcharout - _null_ )); +DATA(insert OID = 1045 ( bpcharout PGNSP PGUID 12 f f t f i 1 2275 "1042" bpcharout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1046 ( varcharin PGNSP PGUID 12 f f t f i 3 1043 "0 26 23" varcharin - _null_ )); +DATA(insert OID = 1046 ( varcharin PGNSP PGUID 12 f f t f i 3 1043 "2275 26 23" varcharin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1047 ( varcharout PGNSP PGUID 12 f f t f i 1 23 "0" varcharout - _null_ )); +DATA(insert OID = 1047 ( varcharout PGNSP PGUID 12 f f t f i 1 2275 "1043" varcharout - _null_ )); DESCR("(internal)"); DATA(insert OID = 1048 ( bpchareq PGNSP PGUID 12 f f t f i 2 16 "1042 1042" bpchareq - _null_ )); DESCR("equal"); @@ -1335,9 +1331,9 @@ DATA(insert OID = 1080 ( hashbpchar PGNSP PGUID 12 f f t f i 1 23 "1042" ha DESCR("hash"); DATA(insert OID = 1081 ( format_type PGNSP PGUID 12 f f f f s 2 25 "26 23" format_type - _null_ )); DESCR("format a type oid and atttypmod to canonical SQL"); -DATA(insert OID = 1084 ( date_in PGNSP PGUID 12 f f t f s 1 1082 "0" date_in - _null_ )); +DATA(insert OID = 1084 ( date_in PGNSP PGUID 12 f f t f s 1 1082 "2275" date_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1085 ( date_out PGNSP PGUID 12 f f t f s 1 23 "0" date_out - _null_ )); +DATA(insert OID = 1085 ( date_out PGNSP PGUID 12 f f t f s 1 2275 "1082" date_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1086 ( date_eq PGNSP PGUID 12 f f t f i 2 16 "1082 1082" date_eq - _null_ )); DESCR("equal"); @@ -1378,9 +1374,9 @@ DATA(insert OID = 1141 ( date_pli PGNSP PGUID 12 f f t f i 2 1082 "1082 23" DESCR("add"); DATA(insert OID = 1142 ( date_mii PGNSP PGUID 12 f f t f i 2 1082 "1082 23" date_mii - _null_ )); DESCR("subtract"); -DATA(insert OID = 1143 ( time_in PGNSP PGUID 12 f f t f s 1 1083 "0" time_in - _null_ )); +DATA(insert OID = 1143 ( time_in PGNSP PGUID 12 f f t f s 1 1083 "2275" time_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1144 ( time_out PGNSP PGUID 12 f f t f i 1 23 "0" time_out - _null_ )); +DATA(insert OID = 1144 ( time_out PGNSP PGUID 12 f f t f i 1 2275 "1083" time_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1145 ( time_eq PGNSP PGUID 12 f f t f i 2 16 "1083 1083" time_eq - _null_ )); DESCR("equal"); @@ -1394,9 +1390,9 @@ DESCR("multiply"); DATA(insert OID = 1149 ( circle_div_pt PGNSP PGUID 12 f f t f i 2 718 "718 600" circle_div_pt - _null_ )); DESCR("divide"); -DATA(insert OID = 1150 ( timestamptz_in PGNSP PGUID 12 f f t f s 1 1184 "0" timestamptz_in - _null_ )); +DATA(insert OID = 1150 ( timestamptz_in PGNSP PGUID 12 f f t f s 1 1184 "2275" timestamptz_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1151 ( timestamptz_out PGNSP PGUID 12 f f t f s 1 23 "0" timestamptz_out - _null_ )); +DATA(insert OID = 1151 ( timestamptz_out PGNSP PGUID 12 f f t f s 1 2275 "1184" timestamptz_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1152 ( timestamptz_eq PGNSP PGUID 12 f f t f i 2 16 "1184 1184" timestamp_eq - _null_ )); DESCR("equal"); @@ -1413,9 +1409,9 @@ DESCR("greater-than"); DATA(insert OID = 1159 ( timezone PGNSP PGUID 12 f f t f s 2 1114 "25 1184" timestamptz_zone - _null_ )); DESCR("timestamp at a specified time zone"); -DATA(insert OID = 1160 ( interval_in PGNSP PGUID 12 f f t f s 1 1186 "0" interval_in - _null_ )); +DATA(insert OID = 1160 ( interval_in PGNSP PGUID 12 f f t f s 1 1186 "2275" interval_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1161 ( interval_out PGNSP PGUID 12 f f t f i 1 23 "0" interval_out - _null_ )); +DATA(insert OID = 1161 ( interval_out PGNSP PGUID 12 f f t f i 1 2275 "1186" interval_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1162 ( interval_eq PGNSP PGUID 12 f f t f i 2 16 "1186 1186" interval_eq - _null_ )); DESCR("equal"); @@ -1569,18 +1565,18 @@ DATA(insert OID = 1297 ( datetimetz_pl PGNSP PGUID 12 f f t f i 2 1184 "1082 DESCR("convert date and time with time zone to timestamp with time zone"); DATA(insert OID = 1298 ( timetzdate_pl PGNSP PGUID 14 f f t f i 2 1184 "1266 1082" "select ($2 + $1)" - _null_ )); DESCR("convert time with time zone and date to timestamp"); -DATA(insert OID = 1299 ( now PGNSP PGUID 12 f f t f s 0 1184 "0" now - _null_ )); +DATA(insert OID = 1299 ( now PGNSP PGUID 12 f f t f s 0 1184 "" now - _null_ )); DESCR("current transaction time"); /* OIDS 1300 - 1399 */ -DATA(insert OID = 1300 ( positionsel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" positionsel - _null_ )); +DATA(insert OID = 1300 ( positionsel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" positionsel - _null_ )); DESCR("restriction selectivity for position-comparison operators"); -DATA(insert OID = 1301 ( positionjoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" positionjoinsel - _null_ )); +DATA(insert OID = 1301 ( positionjoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" positionjoinsel - _null_ )); DESCR("join selectivity for position-comparison operators"); -DATA(insert OID = 1302 ( contsel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" contsel - _null_ )); +DATA(insert OID = 1302 ( contsel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" contsel - _null_ )); DESCR("restriction selectivity for containment comparison operators"); -DATA(insert OID = 1303 ( contjoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" contjoinsel - _null_ )); +DATA(insert OID = 1303 ( contjoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" contjoinsel - _null_ )); DESCR("join selectivity for containment comparison operators"); DATA(insert OID = 1304 ( overlaps PGNSP PGUID 12 f f f f i 4 16 "1184 1184 1184 1184" overlaps_timestamp - _null_ )); @@ -1601,9 +1597,9 @@ DESCR("SQL92 interval comparison"); DATA(insert OID = 1311 ( overlaps PGNSP PGUID 14 f f f f i 4 16 "1083 1186 1083 1083" "select ($1, ($1 + $2)) overlaps ($3, $4)" - _null_ )); DESCR("SQL92 interval comparison"); -DATA(insert OID = 1312 ( timestamp_in PGNSP PGUID 12 f f t f s 1 1114 "0" timestamp_in - _null_ )); +DATA(insert OID = 1312 ( timestamp_in PGNSP PGUID 12 f f t f s 1 1114 "2275" timestamp_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1313 ( timestamp_out PGNSP PGUID 12 f f t f s 1 23 "0" timestamp_out - _null_ )); +DATA(insert OID = 1313 ( timestamp_out PGNSP PGUID 12 f f t f s 1 2275 "1114" timestamp_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1314 ( timestamptz_cmp PGNSP PGUID 12 f f t f i 2 23 "1184 1184" timestamp_cmp - _null_ )); DESCR("less-equal-greater"); @@ -1651,9 +1647,9 @@ DATA(insert OID = 1349 ( oidvectortypes PGNSP PGUID 12 f f t f s 1 25 "30" oi DESCR("print type names of oidvector field"); -DATA(insert OID = 1350 ( timetz_in PGNSP PGUID 12 f f t f s 1 1266 "0" timetz_in - _null_ )); +DATA(insert OID = 1350 ( timetz_in PGNSP PGUID 12 f f t f s 1 1266 "2275" timetz_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1351 ( timetz_out PGNSP PGUID 12 f f t f i 1 23 "0" timetz_out - _null_ )); +DATA(insert OID = 1351 ( timetz_out PGNSP PGUID 12 f f t f i 1 2275 "1266" timetz_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1352 ( timetz_eq PGNSP PGUID 12 f f t f i 2 16 "1266 1266" timetz_eq - _null_ )); DESCR("equal"); @@ -1752,7 +1748,7 @@ DESCR("convert varchar to name"); DATA(insert OID = 1401 ( varchar PGNSP PGUID 12 f f t f i 1 1043 "19" name_text - _null_ )); DESCR("convert name to varchar"); -DATA(insert OID = 1402 ( current_schema PGNSP PGUID 12 f f t f s 0 19 "0" current_schema - _null_ )); +DATA(insert OID = 1402 ( current_schema PGNSP PGUID 12 f f t f s 0 19 "" current_schema - _null_ )); DESCR("current schema name"); DATA(insert OID = 1403 ( current_schemas PGNSP PGUID 12 f f t f s 1 1003 "16" current_schemas - _null_ )); DESCR("current schema search list"); @@ -1858,9 +1854,9 @@ DESCR("convert box to polygon"); DATA(insert OID = 1449 ( polygon PGNSP PGUID 12 f f t f i 1 604 "602" path_poly - _null_ )); DESCR("convert path to polygon"); -DATA(insert OID = 1450 ( circle_in PGNSP PGUID 12 f f t f i 1 718 "0" circle_in - _null_ )); +DATA(insert OID = 1450 ( circle_in PGNSP PGUID 12 f f t f i 1 718 "2275" circle_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1451 ( circle_out PGNSP PGUID 12 f f t f i 1 23 "718" circle_out - _null_ )); +DATA(insert OID = 1451 ( circle_out PGNSP PGUID 12 f f t f i 1 2275 "718" circle_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1452 ( circle_same PGNSP PGUID 12 f f t f i 2 16 "718 718" circle_same - _null_ )); DESCR("same as"); @@ -1940,9 +1936,9 @@ DESCR("closest point to line on line segment"); DATA(insert OID = 1489 ( close_lseg PGNSP PGUID 12 f f t f i 2 600 "601 601" close_lseg - _null_ )); DESCR("closest point to line segment on line segment"); -DATA(insert OID = 1490 ( line_in PGNSP PGUID 12 f f t f i 1 628 "0" line_in - _null_ )); +DATA(insert OID = 1490 ( line_in PGNSP PGUID 12 f f t f i 1 628 "2275" line_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1491 ( line_out PGNSP PGUID 12 f f t f i 1 23 "628" line_out - _null_ )); +DATA(insert OID = 1491 ( line_out PGNSP PGUID 12 f f t f i 1 2275 "628" line_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1492 ( line_eq PGNSP PGUID 12 f f t f i 2 16 "628 628" line_eq - _null_ )); DESCR("lines equal?"); @@ -1990,9 +1986,9 @@ DESCR("# points in path"); DATA(insert OID = 1556 ( npoints PGNSP PGUID 12 f f t f i 1 23 "604" poly_npoints - _null_ )); DESCR("number of points in polygon"); -DATA(insert OID = 1564 ( bit_in PGNSP PGUID 12 f f t f i 1 1560 "0" bit_in - _null_ )); +DATA(insert OID = 1564 ( bit_in PGNSP PGUID 12 f f t f i 1 1560 "2275" bit_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1565 ( bit_out PGNSP PGUID 12 f f t f i 1 23 "0" bit_out - _null_ )); +DATA(insert OID = 1565 ( bit_out PGNSP PGUID 12 f f t f i 1 2275 "1560" bit_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1569 ( like PGNSP PGUID 12 f f t f i 2 16 "25 25" textlike - _null_ )); @@ -2015,9 +2011,9 @@ DESCR("set sequence value"); DATA(insert OID = 1765 ( setval PGNSP PGUID 12 f f t f v 3 20 "25 20 16" setval_and_iscalled - _null_ )); DESCR("set sequence value and iscalled status"); -DATA(insert OID = 1579 ( varbit_in PGNSP PGUID 12 f f t f i 1 1562 "0" varbit_in - _null_ )); +DATA(insert OID = 1579 ( varbit_in PGNSP PGUID 12 f f t f i 1 1562 "2275" varbit_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1580 ( varbit_out PGNSP PGUID 12 f f t f i 1 23 "0" varbit_out - _null_ )); +DATA(insert OID = 1580 ( varbit_out PGNSP PGUID 12 f f t f i 1 2275 "1562" varbit_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1581 ( biteq PGNSP PGUID 12 f f t f i 2 16 "1560 1560" biteq - _null_ )); @@ -2035,7 +2031,7 @@ DESCR("less than"); DATA(insert OID = 1596 ( bitcmp PGNSP PGUID 12 f f t f i 2 23 "1560 1560" bitcmp - _null_ )); DESCR("compare"); -DATA(insert OID = 1598 ( random PGNSP PGUID 12 f f t f v 0 701 "0" drandom - _null_ )); +DATA(insert OID = 1598 ( random PGNSP PGUID 12 f f t f v 0 701 "" drandom - _null_ )); DESCR("random value"); DATA(insert OID = 1599 ( setseed PGNSP PGUID 12 f f t f v 1 23 "701" setseed - _null_ )); DESCR("set random seed"); @@ -2062,7 +2058,7 @@ DATA(insert OID = 1608 ( degrees PGNSP PGUID 12 f f t f i 1 701 "701" degrees DESCR("radians to degrees"); DATA(insert OID = 1609 ( radians PGNSP PGUID 12 f f t f i 1 701 "701" radians - _null_ )); DESCR("degrees to radians"); -DATA(insert OID = 1610 ( pi PGNSP PGUID 12 f f t f i 0 701 "0" dpi - _null_ )); +DATA(insert OID = 1610 ( pi PGNSP PGUID 12 f f t f i 0 701 "" dpi - _null_ )); DESCR("PI"); DATA(insert OID = 1618 ( interval_mul PGNSP PGUID 12 f f t f i 2 1186 "1186 701" interval_mul - _null_ )); @@ -2092,7 +2088,7 @@ DESCR("does not match LIKE expression, case-insensitive"); DATA(insert OID = 1637 ( like_escape PGNSP PGUID 12 f f t f i 2 25 "25 25" like_escape - _null_ )); DESCR("convert match pattern to use backslash escapes"); -DATA(insert OID = 1689 ( update_pg_pwd_and_pg_group PGNSP PGUID 12 f f t f v 0 0 "" update_pg_pwd_and_pg_group - _null_ )); +DATA(insert OID = 1689 ( update_pg_pwd_and_pg_group PGNSP PGUID 12 f f t f v 0 2279 "" update_pg_pwd_and_pg_group - _null_ )); DESCR("update pg_pwd and pg_group files"); /* Oracle Compatibility Related Functions - By Edmund Mergl <E.Mergl@bawue.de> */ @@ -2139,11 +2135,11 @@ DESCR("return portion of string"); /* for multi-byte support */ /* return database encoding name */ -DATA(insert OID = 1039 ( getdatabaseencoding PGNSP PGUID 12 f f t f s 0 19 "0" getdatabaseencoding - _null_ )); +DATA(insert OID = 1039 ( getdatabaseencoding PGNSP PGUID 12 f f t f s 0 19 "" getdatabaseencoding - _null_ )); DESCR("encoding name of current database"); /* return client encoding name i.e. session encoding */ -DATA(insert OID = 810 ( pg_client_encoding PGNSP PGUID 12 f f t f s 0 19 "0" pg_client_encoding - _null_ )); +DATA(insert OID = 810 ( pg_client_encoding PGNSP PGUID 12 f f t f s 0 19 "" pg_client_encoding - _null_ )); DESCR("encoding name of current database"); DATA(insert OID = 1717 ( convert PGNSP PGUID 12 f f t f s 2 25 "25 19" pg_convert - _null_ )); @@ -2184,29 +2180,29 @@ DESCR("deparse an encoded expression"); /* Generic referential integrity constraint triggers */ -DATA(insert OID = 1644 ( RI_FKey_check_ins PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_check_ins - _null_ )); +DATA(insert OID = 1644 ( RI_FKey_check_ins PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_check_ins - _null_ )); DESCR("referential integrity FOREIGN KEY ... REFERENCES"); -DATA(insert OID = 1645 ( RI_FKey_check_upd PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_check_upd - _null_ )); +DATA(insert OID = 1645 ( RI_FKey_check_upd PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_check_upd - _null_ )); DESCR("referential integrity FOREIGN KEY ... REFERENCES"); -DATA(insert OID = 1646 ( RI_FKey_cascade_del PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_cascade_del - _null_ )); +DATA(insert OID = 1646 ( RI_FKey_cascade_del PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_cascade_del - _null_ )); DESCR("referential integrity ON DELETE CASCADE"); -DATA(insert OID = 1647 ( RI_FKey_cascade_upd PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_cascade_upd - _null_ )); +DATA(insert OID = 1647 ( RI_FKey_cascade_upd PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_cascade_upd - _null_ )); DESCR("referential integrity ON UPDATE CASCADE"); -DATA(insert OID = 1648 ( RI_FKey_restrict_del PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_restrict_del - _null_ )); +DATA(insert OID = 1648 ( RI_FKey_restrict_del PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_restrict_del - _null_ )); DESCR("referential integrity ON DELETE RESTRICT"); -DATA(insert OID = 1649 ( RI_FKey_restrict_upd PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_restrict_upd - _null_ )); +DATA(insert OID = 1649 ( RI_FKey_restrict_upd PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_restrict_upd - _null_ )); DESCR("referential integrity ON UPDATE RESTRICT"); -DATA(insert OID = 1650 ( RI_FKey_setnull_del PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_setnull_del - _null_ )); +DATA(insert OID = 1650 ( RI_FKey_setnull_del PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_setnull_del - _null_ )); DESCR("referential integrity ON DELETE SET NULL"); -DATA(insert OID = 1651 ( RI_FKey_setnull_upd PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_setnull_upd - _null_ )); +DATA(insert OID = 1651 ( RI_FKey_setnull_upd PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_setnull_upd - _null_ )); DESCR("referential integrity ON UPDATE SET NULL"); -DATA(insert OID = 1652 ( RI_FKey_setdefault_del PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_setdefault_del - _null_ )); +DATA(insert OID = 1652 ( RI_FKey_setdefault_del PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_setdefault_del - _null_ )); DESCR("referential integrity ON DELETE SET DEFAULT"); -DATA(insert OID = 1653 ( RI_FKey_setdefault_upd PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_setdefault_upd - _null_ )); +DATA(insert OID = 1653 ( RI_FKey_setdefault_upd PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_setdefault_upd - _null_ )); DESCR("referential integrity ON UPDATE SET DEFAULT"); -DATA(insert OID = 1654 ( RI_FKey_noaction_del PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_noaction_del - _null_ )); +DATA(insert OID = 1654 ( RI_FKey_noaction_del PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_noaction_del - _null_ )); DESCR("referential integrity ON DELETE NO ACTION"); -DATA(insert OID = 1655 ( RI_FKey_noaction_upd PGNSP PGUID 12 f f t f v 0 0 "" RI_FKey_noaction_upd - _null_ )); +DATA(insert OID = 1655 ( RI_FKey_noaction_upd PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_noaction_upd - _null_ )); DESCR("referential integrity ON UPDATE NO ACTION"); DATA(insert OID = 1666 ( varbiteq PGNSP PGUID 12 f f t f i 2 16 "1562 1562" biteq - _null_ )); @@ -2265,9 +2261,9 @@ DESCR("return portion of bitstring"); /* for mac type support */ -DATA(insert OID = 436 ( macaddr_in PGNSP PGUID 12 f f t f i 1 829 "0" macaddr_in - _null_ )); +DATA(insert OID = 436 ( macaddr_in PGNSP PGUID 12 f f t f i 1 829 "2275" macaddr_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 437 ( macaddr_out PGNSP PGUID 12 f f t f i 1 23 "0" macaddr_out - _null_ )); +DATA(insert OID = 437 ( macaddr_out PGNSP PGUID 12 f f t f i 1 2275 "829" macaddr_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 752 ( text PGNSP PGUID 12 f f t f i 1 25 "829" macaddr_text - _null_ )); @@ -2293,15 +2289,15 @@ DATA(insert OID = 836 ( macaddr_cmp PGNSP PGUID 12 f f t f i 2 23 "829 829" m DESCR("less-equal-greater"); /* for inet type support */ -DATA(insert OID = 910 ( inet_in PGNSP PGUID 12 f f t f i 1 869 "0" inet_in - _null_ )); +DATA(insert OID = 910 ( inet_in PGNSP PGUID 12 f f t f i 1 869 "2275" inet_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 911 ( inet_out PGNSP PGUID 12 f f t f i 1 23 "0" inet_out - _null_ )); +DATA(insert OID = 911 ( inet_out PGNSP PGUID 12 f f t f i 1 2275 "869" inet_out - _null_ )); DESCR("(internal)"); /* for cidr type support */ -DATA(insert OID = 1267 ( cidr_in PGNSP PGUID 12 f f t f i 1 650 "0" cidr_in - _null_ )); +DATA(insert OID = 1267 ( cidr_in PGNSP PGUID 12 f f t f i 1 650 "2275" cidr_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1427 ( cidr_out PGNSP PGUID 12 f f t f i 1 23 "0" cidr_out - _null_ )); +DATA(insert OID = 1427 ( cidr_out PGNSP PGUID 12 f f t f i 1 2275 "650" cidr_out - _null_ )); DESCR("(internal)"); /* these are used for both inet and cidr */ @@ -2367,9 +2363,9 @@ DESCR("hash"); /* OID's 1700 - 1799 NUMERIC data type */ -DATA(insert OID = 1701 ( numeric_in PGNSP PGUID 12 f f t f i 3 1700 "0 26 23" numeric_in - _null_ )); +DATA(insert OID = 1701 ( numeric_in PGNSP PGUID 12 f f t f i 3 1700 "2275 26 23" numeric_in - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1702 ( numeric_out PGNSP PGUID 12 f f t f i 1 23 "0" numeric_out - _null_ )); +DATA(insert OID = 1702 ( numeric_out PGNSP PGUID 12 f f t f i 1 2275 "1700" numeric_out - _null_ )); DESCR("(internal)"); DATA(insert OID = 1703 ( numeric PGNSP PGUID 12 f f t f i 2 1700 "1700 23" numeric - _null_ )); DESCR("adjust numeric to typmod precision/scale"); @@ -2505,9 +2501,9 @@ DESCR("quote an identifier for usage in a querystring"); DATA(insert OID = 1283 ( quote_literal PGNSP PGUID 12 f f t f i 1 25 "25" quote_literal - _null_ )); DESCR("quote a literal for usage in a querystring"); -DATA(insert OID = 1798 ( oidin PGNSP PGUID 12 f f t f i 1 26 "0" oidin - _null_ )); +DATA(insert OID = 1798 ( oidin PGNSP PGUID 12 f f t f i 1 26 "2275" oidin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 1799 ( oidout PGNSP PGUID 12 f f t f i 1 23 "0" oidout - _null_ )); +DATA(insert OID = 1799 ( oidout PGNSP PGUID 12 f f t f i 1 2275 "26" oidout - _null_ )); DESCR("(internal)"); @@ -2519,37 +2515,37 @@ DATA(insert OID = 1812 ( bit_length PGNSP PGUID 14 f f t f i 1 23 "1560" "se DESCR("length in bits"); /* Selectivity estimators for LIKE and related operators */ -DATA(insert OID = 1814 ( iclikesel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" iclikesel - _null_ )); +DATA(insert OID = 1814 ( iclikesel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" iclikesel - _null_ )); DESCR("restriction selectivity of ILIKE"); -DATA(insert OID = 1815 ( icnlikesel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" icnlikesel - _null_ )); +DATA(insert OID = 1815 ( icnlikesel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" icnlikesel - _null_ )); DESCR("restriction selectivity of NOT ILIKE"); -DATA(insert OID = 1816 ( iclikejoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" iclikejoinsel - _null_ )); +DATA(insert OID = 1816 ( iclikejoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" iclikejoinsel - _null_ )); DESCR("join selectivity of ILIKE"); -DATA(insert OID = 1817 ( icnlikejoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" icnlikejoinsel - _null_ )); +DATA(insert OID = 1817 ( icnlikejoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" icnlikejoinsel - _null_ )); DESCR("join selectivity of NOT ILIKE"); -DATA(insert OID = 1818 ( regexeqsel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" regexeqsel - _null_ )); +DATA(insert OID = 1818 ( regexeqsel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" regexeqsel - _null_ )); DESCR("restriction selectivity of regex match"); -DATA(insert OID = 1819 ( likesel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" likesel - _null_ )); +DATA(insert OID = 1819 ( likesel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" likesel - _null_ )); DESCR("restriction selectivity of LIKE"); -DATA(insert OID = 1820 ( icregexeqsel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" icregexeqsel - _null_ )); +DATA(insert OID = 1820 ( icregexeqsel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" icregexeqsel - _null_ )); DESCR("restriction selectivity of case-insensitive regex match"); -DATA(insert OID = 1821 ( regexnesel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" regexnesel - _null_ )); +DATA(insert OID = 1821 ( regexnesel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" regexnesel - _null_ )); DESCR("restriction selectivity of regex non-match"); -DATA(insert OID = 1822 ( nlikesel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" nlikesel - _null_ )); +DATA(insert OID = 1822 ( nlikesel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" nlikesel - _null_ )); DESCR("restriction selectivity of NOT LIKE"); -DATA(insert OID = 1823 ( icregexnesel PGNSP PGUID 12 f f t f s 4 701 "0 26 0 23" icregexnesel - _null_ )); +DATA(insert OID = 1823 ( icregexnesel PGNSP PGUID 12 f f t f s 4 701 "2281 26 2281 23" icregexnesel - _null_ )); DESCR("restriction selectivity of case-insensitive regex non-match"); -DATA(insert OID = 1824 ( regexeqjoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" regexeqjoinsel - _null_ )); +DATA(insert OID = 1824 ( regexeqjoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" regexeqjoinsel - _null_ )); DESCR("join selectivity of regex match"); -DATA(insert OID = 1825 ( likejoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" likejoinsel - _null_ )); +DATA(insert OID = 1825 ( likejoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" likejoinsel - _null_ )); DESCR("join selectivity of LIKE"); -DATA(insert OID = 1826 ( icregexeqjoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" icregexeqjoinsel - _null_ )); +DATA(insert OID = 1826 ( icregexeqjoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" icregexeqjoinsel - _null_ )); DESCR("join selectivity of case-insensitive regex match"); -DATA(insert OID = 1827 ( regexnejoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" regexnejoinsel - _null_ )); +DATA(insert OID = 1827 ( regexnejoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" regexnejoinsel - _null_ )); DESCR("join selectivity of regex non-match"); -DATA(insert OID = 1828 ( nlikejoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" nlikejoinsel - _null_ )); +DATA(insert OID = 1828 ( nlikejoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" nlikejoinsel - _null_ )); DESCR("join selectivity of NOT LIKE"); -DATA(insert OID = 1829 ( icregexnejoinsel PGNSP PGUID 12 f f t f s 3 701 "0 26 0" icregexnejoinsel - _null_ )); +DATA(insert OID = 1829 ( icregexnejoinsel PGNSP PGUID 12 f f t f s 3 701 "2281 26 2281" icregexnejoinsel - _null_ )); DESCR("join selectivity of case-insensitive regex non-match"); /* Aggregate-related functions */ @@ -2962,7 +2958,7 @@ DATA(insert OID = 2144 ( min PGNSP PGUID 12 t f f f i 1 1186 "1186" aggrega DATA(insert OID = 2145 ( min PGNSP PGUID 12 t f f f i 1 25 "25" aggregate_dummy - _null_ )); DATA(insert OID = 2146 ( min PGNSP PGUID 12 t f f f i 1 1700 "1700" aggregate_dummy - _null_ )); -DATA(insert OID = 2147 ( count PGNSP PGUID 12 t f f f i 1 20 "0" aggregate_dummy - _null_ )); +DATA(insert OID = 2147 ( count PGNSP PGUID 12 t f f f i 1 20 "2276" aggregate_dummy - _null_ )); DATA(insert OID = 2148 ( variance PGNSP PGUID 12 t f f f i 1 1700 "20" aggregate_dummy - _null_ )); DATA(insert OID = 2149 ( variance PGNSP PGUID 12 t f f f i 1 1700 "23" aggregate_dummy - _null_ )); @@ -2979,32 +2975,32 @@ DATA(insert OID = 2158 ( stddev PGNSP PGUID 12 t f f f i 1 701 "701" aggrega DATA(insert OID = 2159 ( stddev PGNSP PGUID 12 t f f f i 1 1700 "1700" aggregate_dummy - _null_ )); -DATA(insert OID = 2212 ( regprocedurein PGNSP PGUID 12 f f t f s 1 2202 "0" regprocedurein - _null_ )); +DATA(insert OID = 2212 ( regprocedurein PGNSP PGUID 12 f f t f s 1 2202 "2275" regprocedurein - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2213 ( regprocedureout PGNSP PGUID 12 f f t f s 1 23 "0" regprocedureout - _null_ )); +DATA(insert OID = 2213 ( regprocedureout PGNSP PGUID 12 f f t f s 1 2275 "2202" regprocedureout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2214 ( regoperin PGNSP PGUID 12 f f t f s 1 2203 "0" regoperin - _null_ )); +DATA(insert OID = 2214 ( regoperin PGNSP PGUID 12 f f t f s 1 2203 "2275" regoperin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2215 ( regoperout PGNSP PGUID 12 f f t f s 1 23 "0" regoperout - _null_ )); +DATA(insert OID = 2215 ( regoperout PGNSP PGUID 12 f f t f s 1 2275 "2203" regoperout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2216 ( regoperatorin PGNSP PGUID 12 f f t f s 1 2204 "0" regoperatorin - _null_ )); +DATA(insert OID = 2216 ( regoperatorin PGNSP PGUID 12 f f t f s 1 2204 "2275" regoperatorin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2217 ( regoperatorout PGNSP PGUID 12 f f t f s 1 23 "0" regoperatorout - _null_ )); +DATA(insert OID = 2217 ( regoperatorout PGNSP PGUID 12 f f t f s 1 2275 "2204" regoperatorout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2218 ( regclassin PGNSP PGUID 12 f f t f s 1 2205 "0" regclassin - _null_ )); +DATA(insert OID = 2218 ( regclassin PGNSP PGUID 12 f f t f s 1 2205 "2275" regclassin - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2219 ( regclassout PGNSP PGUID 12 f f t f s 1 23 "0" regclassout - _null_ )); +DATA(insert OID = 2219 ( regclassout PGNSP PGUID 12 f f t f s 1 2275 "2205" regclassout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2220 ( regtypein PGNSP PGUID 12 f f t f s 1 2206 "0" regtypein - _null_ )); +DATA(insert OID = 2220 ( regtypein PGNSP PGUID 12 f f t f s 1 2206 "2275" regtypein - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2221 ( regtypeout PGNSP PGUID 12 f f t f s 1 23 "0" regtypeout - _null_ )); +DATA(insert OID = 2221 ( regtypeout PGNSP PGUID 12 f f t f s 1 2275 "2206" regtypeout - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2246 ( fmgr_internal_validator PGNSP PGUID 12 f f t f s 1 26 "23" fmgr_internal_validator - _null_ )); +DATA(insert OID = 2246 ( fmgr_internal_validator PGNSP PGUID 12 f f t f s 1 2278 "26" fmgr_internal_validator - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2247 ( fmgr_c_validator PGNSP PGUID 12 f f t f s 1 26 "23" fmgr_c_validator - _null_ )); +DATA(insert OID = 2247 ( fmgr_c_validator PGNSP PGUID 12 f f t f s 1 2278 "26" fmgr_c_validator - _null_ )); DESCR("(internal)"); -DATA(insert OID = 2248 ( fmgr_sql_validator PGNSP PGUID 12 f f t f s 1 26 "23" fmgr_sql_validator - _null_ )); +DATA(insert OID = 2248 ( fmgr_sql_validator PGNSP PGUID 12 f f t f s 1 2278 "26" fmgr_sql_validator - _null_ )); DESCR("(internal)"); DATA(insert OID = 2250 ( has_database_privilege PGNSP PGUID 12 f f t f s 3 16 "19 25 25" has_database_privilege_name_name - _null_ )); @@ -3059,6 +3055,46 @@ DESCR("current user privilege on schema by schema name"); DATA(insert OID = 2273 ( has_schema_privilege PGNSP PGUID 12 f f t f s 2 16 "26 25" has_schema_privilege_id - _null_ )); DESCR("current user privilege on schema by schema oid"); + + +DATA(insert OID = 2290 ( record_in PGNSP PGUID 12 f f t f i 1 2249 "2275" record_in - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2291 ( record_out PGNSP PGUID 12 f f t f i 1 2275 "2249" record_out - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2292 ( cstring_in PGNSP PGUID 12 f f t f i 1 2275 "2275" cstring_in - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2293 ( cstring_out PGNSP PGUID 12 f f t f i 1 2275 "2275" cstring_out - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2294 ( any_in PGNSP PGUID 12 f f t f i 1 2276 "2275" any_in - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2295 ( any_out PGNSP PGUID 12 f f t f i 1 2275 "2276" any_out - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2296 ( anyarray_in PGNSP PGUID 12 f f t f i 1 2277 "2275" anyarray_in - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2297 ( anyarray_out PGNSP PGUID 12 f f t f i 1 2275 "2277" anyarray_out - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2298 ( void_in PGNSP PGUID 12 f f t f i 1 2278 "2275" void_in - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2299 ( void_out PGNSP PGUID 12 f f t f i 1 2275 "2278" void_out - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2300 ( trigger_in PGNSP PGUID 12 f f t f i 1 2279 "2275" trigger_in - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2301 ( trigger_out PGNSP PGUID 12 f f t f i 1 2275 "2279" trigger_out - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2302 ( language_handler_in PGNSP PGUID 12 f f t f i 1 2280 "2275" language_handler_in - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2303 ( language_handler_out PGNSP PGUID 12 f f t f i 1 2275 "2280" language_handler_out - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2304 ( internal_in PGNSP PGUID 12 f f t f i 1 2281 "2275" internal_in - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2305 ( internal_out PGNSP PGUID 12 f f t f i 1 2275 "2281" internal_out - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2306 ( opaque_in PGNSP PGUID 12 f f t f i 1 2282 "2275" opaque_in - _null_ )); +DESCR("(internal)"); +DATA(insert OID = 2307 ( opaque_out PGNSP PGUID 12 f f t f i 1 2275 "2282" opaque_out - _null_ )); +DESCR("(internal)"); + + /* * Symbolic values for provolatile column: these indicate whether the result * of a function is dependent *only* on the values of its explicit arguments, diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 3d026acc0832d94fdf7bf56debbaa917d785086a..dc39ecef79eb4362669fb35bfe4e896db1c55712 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_type.h,v 1.127 2002/08/05 02:30:50 tgl Exp $ + * $Id: pg_type.h,v 1.128 2002/08/22 00:01:48 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -505,13 +505,30 @@ DATA(insert OID = 2211 ( _regtype PGNSP PGUID -1 f b t \054 0 2206 array_in /* * pseudo-types * - * types with typtype='p' are special types that represent classes of types - * that are not easily defined in advance. Currently there is only one pseudo - * type -- record. The record type is used to specify that the value is a - * tuple, but of unknown structure until runtime. + * types with typtype='p' represent various special cases in the type system. + * + * These cannot be used to define table columns, but are valid as function + * argument and result types (if supported by the function's implementation + * language). */ -DATA(insert OID = 2249 ( record PGNSP PGUID 4 t p t \054 0 0 oidin oidout i p f 0 -1 0 _null_ _null_ )); +DATA(insert OID = 2249 ( record PGNSP PGUID 4 t p t \054 0 0 record_in record_out i p f 0 -1 0 _null_ _null_ )); #define RECORDOID 2249 +DATA(insert OID = 2275 ( cstring PGNSP PGUID 4 t p t \054 0 0 cstring_in cstring_out i p f 0 -1 0 _null_ _null_ )); +#define CSTRINGOID 2275 +DATA(insert OID = 2276 ( any PGNSP PGUID 4 t p t \054 0 0 any_in any_out i p f 0 -1 0 _null_ _null_ )); +#define ANYOID 2276 +DATA(insert OID = 2277 ( anyarray PGNSP PGUID 4 t p t \054 0 0 anyarray_in anyarray_out i p f 0 -1 0 _null_ _null_ )); +#define ANYARRAYOID 2277 +DATA(insert OID = 2278 ( void PGNSP PGUID 4 t p t \054 0 0 void_in void_out i p f 0 -1 0 _null_ _null_ )); +#define VOIDOID 2278 +DATA(insert OID = 2279 ( trigger PGNSP PGUID 4 t p t \054 0 0 trigger_in trigger_out i p f 0 -1 0 _null_ _null_ )); +#define TRIGGEROID 2279 +DATA(insert OID = 2280 ( language_handler PGNSP PGUID 4 t p t \054 0 0 language_handler_in language_handler_out i p f 0 -1 0 _null_ _null_ )); +#define LANGUAGE_HANDLEROID 2280 +DATA(insert OID = 2281 ( internal PGNSP PGUID 4 t p t \054 0 0 internal_in internal_out i p f 0 -1 0 _null_ _null_ )); +#define INTERNALOID 2281 +DATA(insert OID = 2282 ( opaque PGNSP PGUID 4 t p t \054 0 0 opaque_in opaque_out i p f 0 -1 0 _null_ _null_ )); +#define OPAQUEOID 2282 /* * prototypes for functions in pg_type.c diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h index ac98fb84f6e57018d1158a156badda06a8d47b0a..c600aa932dd0efa84166f253c28bd535373467b4 100644 --- a/src/include/parser/parse_func.h +++ b/src/include/parser/parse_func.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parse_func.h,v 1.41 2002/06/20 20:29:51 momjian Exp $ + * $Id: parse_func.h,v 1.42 2002/08/22 00:01:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -58,6 +58,6 @@ extern Oid find_aggregate_func(const char *caller, List *aggname, extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes); extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes, - bool opaqueOK, const char *caller); + const char *caller); #endif /* PARSE_FUNC_H */ diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index e9937ad751e2809aa03c814ddc945b1160bd312f..c18a17be9ae63c125ec07c5fa2f4d523fb0062a2 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: builtins.h,v 1.193 2002/08/20 04:46:00 momjian Exp $ + * $Id: builtins.h,v 1.194 2002/08/22 00:01:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -93,8 +93,6 @@ extern Datum int2out(PG_FUNCTION_ARGS); extern Datum int2vectorin(PG_FUNCTION_ARGS); extern Datum int2vectorout(PG_FUNCTION_ARGS); extern Datum int2vectoreq(PG_FUNCTION_ARGS); -extern Datum int44in(PG_FUNCTION_ARGS); -extern Datum int44out(PG_FUNCTION_ARGS); extern Datum int4in(PG_FUNCTION_ARGS); extern Datum int4out(PG_FUNCTION_ARGS); extern Datum i2toi4(PG_FUNCTION_ARGS); @@ -343,6 +341,26 @@ extern Datum oidvectorle(PG_FUNCTION_ARGS); extern Datum oidvectorge(PG_FUNCTION_ARGS); extern Datum oidvectorgt(PG_FUNCTION_ARGS); +/* pseudotypes.c */ +extern Datum record_in(PG_FUNCTION_ARGS); +extern Datum record_out(PG_FUNCTION_ARGS); +extern Datum cstring_in(PG_FUNCTION_ARGS); +extern Datum cstring_out(PG_FUNCTION_ARGS); +extern Datum any_in(PG_FUNCTION_ARGS); +extern Datum any_out(PG_FUNCTION_ARGS); +extern Datum anyarray_in(PG_FUNCTION_ARGS); +extern Datum anyarray_out(PG_FUNCTION_ARGS); +extern Datum void_in(PG_FUNCTION_ARGS); +extern Datum void_out(PG_FUNCTION_ARGS); +extern Datum trigger_in(PG_FUNCTION_ARGS); +extern Datum trigger_out(PG_FUNCTION_ARGS); +extern Datum language_handler_in(PG_FUNCTION_ARGS); +extern Datum language_handler_out(PG_FUNCTION_ARGS); +extern Datum internal_in(PG_FUNCTION_ARGS); +extern Datum internal_out(PG_FUNCTION_ARGS); +extern Datum opaque_in(PG_FUNCTION_ARGS); +extern Datum opaque_out(PG_FUNCTION_ARGS); + /* regexp.c */ extern Datum nameregexeq(PG_FUNCTION_ARGS); extern Datum nameregexne(PG_FUNCTION_ARGS); diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index c03e1a241e273490c57f944038bd1fadc7a3d63c..ccd385b7779fa65c062afeb25fdd49b023b134f5 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: lsyscache.h,v 1.57 2002/08/05 02:30:50 tgl Exp $ + * $Id: lsyscache.h,v 1.58 2002/08/22 00:01:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -52,6 +52,8 @@ extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval); extern char get_typstorage(Oid typid); extern Node *get_typdefault(Oid typid); extern char get_typtype(Oid typid); +extern bool getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem, + bool *typIsVarlena); extern Oid getBaseType(Oid typid); extern Oid getBaseTypeTypeMod(Oid typid, int32 *typmod); extern int32 get_typavgwidth(Oid typid, int32 typmod); diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 7533e5784361a404cf1d62e7e39303663204e108..c617c861141dfa461f24ec8668d8162e14b42694 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -33,7 +33,7 @@ * ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.31 2002/06/15 19:54:24 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.32 2002/08/22 00:01:49 tgl Exp $ * **********************************************************************/ @@ -619,15 +619,34 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) { free(prodesc->proname); free(prodesc); - if (!OidIsValid(procStruct->prorettype)) - elog(ERROR, "plperl functions cannot return type \"opaque\"" - "\n\texcept when used as triggers"); - else - elog(ERROR, "plperl: cache lookup for return type %u failed", - procStruct->prorettype); + elog(ERROR, "plperl: cache lookup for return type %u failed", + procStruct->prorettype); } typeStruct = (Form_pg_type) GETSTRUCT(typeTup); + /* Disallow pseudotype result, except VOID */ + if (typeStruct->typtype == 'p') + { + if (procStruct->prorettype == VOIDOID) + /* okay */; + else if (procStruct->prorettype == TRIGGEROID || + procStruct->prorettype == OPAQUEOID) + { + free(prodesc->proname); + free(prodesc); + elog(ERROR, "plperl functions cannot return type %s" + "\n\texcept when used as triggers", + format_type_be(procStruct->prorettype)); + } + else + { + free(prodesc->proname); + free(prodesc); + elog(ERROR, "plperl functions cannot return type %s", + format_type_be(procStruct->prorettype)); + } + } + if (typeStruct->typrelid != InvalidOid) { free(prodesc->proname); @@ -657,14 +676,20 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) { free(prodesc->proname); free(prodesc); - if (!OidIsValid(procStruct->proargtypes[i])) - elog(ERROR, "plperl functions cannot take type \"opaque\""); - else - elog(ERROR, "plperl: cache lookup for argument type %u failed", - procStruct->proargtypes[i]); + elog(ERROR, "plperl: cache lookup for argument type %u failed", + procStruct->proargtypes[i]); } typeStruct = (Form_pg_type) GETSTRUCT(typeTup); + /* Disallow pseudotype argument */ + if (typeStruct->typtype == 'p') + { + free(prodesc->proname); + free(prodesc); + elog(ERROR, "plperl functions cannot take type %s", + format_type_be(procStruct->proargtypes[i])); + } + if (typeStruct->typrelid != InvalidOid) prodesc->arg_is_rel[i] = 1; else diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index ebb2312dae4a847ac61a750df023eb1b6db77539..c85207780f1621fde1a6d91cf07dfcef313c4f92 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.46 2002/08/15 16:36:08 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.47 2002/08/22 00:01:50 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -212,15 +212,25 @@ plpgsql_compile(Oid fn_oid, int functype) ObjectIdGetDatum(procStruct->prorettype), 0, 0, 0); if (!HeapTupleIsValid(typeTup)) + elog(ERROR, "cache lookup for return type %u failed", + procStruct->prorettype); + typeStruct = (Form_pg_type) GETSTRUCT(typeTup); + + /* Disallow pseudotype result, except VOID */ + if (typeStruct->typtype == 'p') { - if (!OidIsValid(procStruct->prorettype)) - elog(ERROR, "plpgsql functions cannot return type \"opaque\"" - "\n\texcept when used as triggers"); + if (procStruct->prorettype == VOIDOID) + /* okay */; + else if (procStruct->prorettype == TRIGGEROID || + procStruct->prorettype == OPAQUEOID) + elog(ERROR, "plpgsql functions cannot return type %s" + "\n\texcept when used as triggers", + format_type_be(procStruct->prorettype)); else - elog(ERROR, "cache lookup for return type %u failed", - procStruct->prorettype); + elog(ERROR, "plpgsql functions cannot return type %s", + format_type_be(procStruct->prorettype)); } - typeStruct = (Form_pg_type) GETSTRUCT(typeTup); + if (typeStruct->typrelid != InvalidOid) function->fn_retistuple = true; else @@ -248,15 +258,15 @@ plpgsql_compile(Oid fn_oid, int functype) ObjectIdGetDatum(procStruct->proargtypes[i]), 0, 0, 0); if (!HeapTupleIsValid(typeTup)) - { - if (!OidIsValid(procStruct->proargtypes[i])) - elog(ERROR, "plpgsql functions cannot take type \"opaque\""); - else - elog(ERROR, "cache lookup for argument type %u failed", - procStruct->proargtypes[i]); - } + elog(ERROR, "cache lookup for argument type %u failed", + procStruct->proargtypes[i]); typeStruct = (Form_pg_type) GETSTRUCT(typeTup); + /* Disallow pseudotype argument */ + if (typeStruct->typtype == 'p') + elog(ERROR, "plpgsql functions cannot take type %s", + format_type_be(procStruct->proargtypes[i])); + if (typeStruct->typrelid != InvalidOid) { /* diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index 6d26cc75ddb73399d22294ac5620a7309e89b070..986937e5e0aaa784af5e0d33690cc7176f6e8f33 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -29,7 +29,7 @@ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.19 2002/07/20 05:16:59 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.20 2002/08/22 00:01:50 tgl Exp $ * ********************************************************************* */ @@ -447,7 +447,7 @@ plpython_call_handler(PG_FUNCTION_ARGS) * this action. MODIFY means the tuple has been modified, so update * tuple and perform action. SKIP and MODIFY assume the trigger fires * BEFORE the event and is ROW level. postgres expects the function - * to take no arguments and return an argument of type opaque. + * to take no arguments and return an argument of type trigger. */ HeapTuple PLy_trigger_handler(FunctionCallInfo fcinfo, PLyProcedure * proc) diff --git a/src/pl/plpython/plpython_function.sql b/src/pl/plpython/plpython_function.sql index 46083ab2ba2554b8f544a8dd8a4cbd4e0e07356e..46ab4babd358006c407ad0a40b3d6da64a0dfddb 100644 --- a/src/pl/plpython/plpython_function.sql +++ b/src/pl/plpython/plpython_function.sql @@ -92,7 +92,7 @@ return words' -- vigorously resisted all efforts at correction. they have -- since gone bankrupt... -CREATE FUNCTION users_insert() returns opaque +CREATE FUNCTION users_insert() returns trigger AS 'if TD["new"]["fname"] == None or TD["new"]["lname"] == None: return "SKIP" @@ -108,7 +108,7 @@ return rv' LANGUAGE 'plpython'; -CREATE FUNCTION users_update() returns opaque +CREATE FUNCTION users_update() returns trigger AS 'if TD["event"] == "UPDATE": if TD["old"]["fname"] != TD["new"]["fname"] and TD["old"]["fname"] == TD["args"][0]: @@ -117,7 +117,7 @@ return None' LANGUAGE 'plpython'; -CREATE FUNCTION users_delete() RETURNS opaque +CREATE FUNCTION users_delete() RETURNS trigger AS 'if TD["old"]["fname"] == TD["args"][0]: return "SKIP" diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index 6f2080b1a433498b7ad12988ae02e51ed993f212..477dd52d1fd891157c3277979b1d5baa987a934a 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -31,7 +31,7 @@ * ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.59 2002/07/20 05:16:59 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.60 2002/08/22 00:01:50 tgl Exp $ * **********************************************************************/ @@ -1051,15 +1051,34 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger) { free(prodesc->proname); free(prodesc); - if (!OidIsValid(procStruct->prorettype)) - elog(ERROR, "pltcl functions cannot return type \"opaque\"" - "\n\texcept when used as triggers"); - else - elog(ERROR, "pltcl: cache lookup for return type %u failed", - procStruct->prorettype); + elog(ERROR, "pltcl: cache lookup for return type %u failed", + procStruct->prorettype); } typeStruct = (Form_pg_type) GETSTRUCT(typeTup); + /* Disallow pseudotype result, except VOID */ + if (typeStruct->typtype == 'p') + { + if (procStruct->prorettype == VOIDOID) + /* okay */; + else if (procStruct->prorettype == TRIGGEROID || + procStruct->prorettype == OPAQUEOID) + { + free(prodesc->proname); + free(prodesc); + elog(ERROR, "pltcl functions cannot return type %s" + "\n\texcept when used as triggers", + format_type_be(procStruct->prorettype)); + } + else + { + free(prodesc->proname); + free(prodesc); + elog(ERROR, "pltcl functions cannot return type %s", + format_type_be(procStruct->prorettype)); + } + } + if (typeStruct->typrelid != InvalidOid) { free(prodesc->proname); @@ -1090,14 +1109,20 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger) { free(prodesc->proname); free(prodesc); - if (!OidIsValid(procStruct->proargtypes[i])) - elog(ERROR, "pltcl functions cannot take type \"opaque\""); - else - elog(ERROR, "pltcl: cache lookup for argument type %u failed", - procStruct->proargtypes[i]); + elog(ERROR, "pltcl: cache lookup for argument type %u failed", + procStruct->proargtypes[i]); } typeStruct = (Form_pg_type) GETSTRUCT(typeTup); + /* Disallow pseudotype argument */ + if (typeStruct->typtype == 'p') + { + free(prodesc->proname); + free(prodesc); + elog(ERROR, "pltcl functions cannot take type %s", + format_type_be(procStruct->proargtypes[i])); + } + if (typeStruct->typrelid != InvalidOid) { prodesc->arg_is_rel[i] = 1; diff --git a/src/pl/tcl/test/test_setup.sql b/src/pl/tcl/test/test_setup.sql index 918e2212696725aa5300e1b56f7b50e20be7d304..c7902386f40f73c6e9a73abe6cc85a09bcb63a28 100644 --- a/src/pl/tcl/test/test_setup.sql +++ b/src/pl/tcl/test/test_setup.sql @@ -58,7 +58,7 @@ create function check_pkey1_exists(int4, bpchar) returns bool as ' -- -- Trigger function on every change to T_pkey1 -- -create function trig_pkey1_before() returns opaque as ' +create function trig_pkey1_before() returns trigger as ' # # Create prepared plans on the first call # @@ -152,7 +152,7 @@ create trigger pkey1_before before insert or update or delete on T_pkey1 -- Trigger function to check for duplicate keys in T_pkey2 -- and to force key2 to be upper case only without leading whitespaces -- -create function trig_pkey2_before() returns opaque as ' +create function trig_pkey2_before() returns trigger as ' # # Prepare plan on first call # @@ -195,7 +195,7 @@ create trigger pkey2_before before insert or update on T_pkey2 -- in T_pkey2 are done so the trigger for primkey check on T_dta2 -- fired on our updates will see the new key values in T_pkey2. -- -create function trig_pkey2_after() returns opaque as ' +create function trig_pkey2_after() returns trigger as ' # # Prepare plans on first call # @@ -282,7 +282,7 @@ create trigger pkey2_after after update or delete on T_pkey2 -- -- Generic trigger function to check references in T_dta1 and T_dta2 -- -create function check_primkey() returns opaque as ' +create function check_primkey() returns trigger as ' # # For every trigger/relation pair we create # a saved plan and hold them in GD diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out index 300e1744a2497db816f7562abac32476ffa33bc6..fa421e40badab41e643bda89d9f905010deb3583 100644 --- a/src/test/regress/expected/copy2.out +++ b/src/test/regress/expected/copy2.out @@ -6,13 +6,13 @@ CREATE TABLE x ( e text ); NOTICE: CREATE TABLE will create implicit sequence 'x_a_seq' for SERIAL column 'x.a' -CREATE FUNCTION fn_x_before () RETURNS OPAQUE AS ' +CREATE FUNCTION fn_x_before () RETURNS TRIGGER AS ' BEGIN NEW.e := ''before trigger fired''::text; return NEW; END; ' language 'plpgsql'; -CREATE FUNCTION fn_x_after () RETURNS OPAQUE AS ' +CREATE FUNCTION fn_x_after () RETURNS TRIGGER AS ' BEGIN UPDATE x set e=''after trigger fired'' where c=''stuff''; return NULL; diff --git a/src/test/regress/expected/create_type.out b/src/test/regress/expected/create_type.out index 68dc8fbd5e57be55c90c2b0488781091c44ee59d..a177153d29851e0898ab316b23298aed048fccb3 100644 --- a/src/test/regress/expected/create_type.out +++ b/src/test/regress/expected/create_type.out @@ -14,18 +14,39 @@ CREATE TYPE city_budget ( element = int4 ); -- Test type-related default values (broken in releases before PG 7.2) +-- Make dummy I/O routines using the existing internal support for int4, text +CREATE FUNCTION int42_in(cstring) + RETURNS int42 + AS 'int4in' + LANGUAGE 'internal' WITH (isStrict); +WARNING: ProcedureCreate: type int42 is not yet defined +CREATE FUNCTION int42_out(int42) + RETURNS cstring + AS 'int4out' + LANGUAGE 'internal' WITH (isStrict); +WARNING: Argument type "int42" is only a shell +CREATE FUNCTION text_w_default_in(cstring) + RETURNS text_w_default + AS 'textin' + LANGUAGE 'internal' WITH (isStrict); +WARNING: ProcedureCreate: type text_w_default is not yet defined +CREATE FUNCTION text_w_default_out(text_w_default) + RETURNS cstring + AS 'textout' + LANGUAGE 'internal' WITH (isStrict); +WARNING: Argument type "text_w_default" is only a shell CREATE TYPE int42 ( internallength = 4, - input = int4in, - output = int4out, + input = int42_in, + output = int42_out, alignment = int4, default = 42, passedbyvalue ); CREATE TYPE text_w_default ( internallength = variable, - input = textin, - output = textout, + input = text_w_default_in, + output = text_w_default_out, alignment = int4, default = 'zippo' ); diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index cb1193b0407eb9365024747b864e7cac47d58c60..efdc8c6a5006a99c1f594a34e5dc282b6e2322bc 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -16,16 +16,23 @@ -- that test creates some bogus operators... -- **************** pg_proc **************** -- Look for illegal values in pg_proc fields. --- NOTE: currently there are a few pg_proc entries that have prorettype = 0. --- Someday that ought to be cleaned up. +-- NOTE: in reality pronargs could be more than 10, but I'm too lazy to put +-- a larger number of proargtypes check clauses in here. If we ever have +-- more-than-10-arg functions in the standard catalogs, extend this query. SELECT p1.oid, p1.proname FROM pg_proc as p1 -WHERE (p1.prolang = 0 OR p1.prorettype = 0 OR - p1.pronargs < 0 OR p1.pronargs > 16) - AND p1.proname !~ '^pl[^_]+_call_handler$' - AND p1.proname !~ '^RI_FKey_' - AND p1.proname !~ 'costestimate$' - AND p1.proname != 'update_pg_pwd_and_pg_group'; +WHERE p1.prolang = 0 OR p1.prorettype = 0 OR + p1.pronargs < 0 OR p1.pronargs > 10 OR + (p1.proargtypes[0] = 0 AND p1.pronargs > 0) OR + (p1.proargtypes[1] = 0 AND p1.pronargs > 1) OR + (p1.proargtypes[2] = 0 AND p1.pronargs > 2) OR + (p1.proargtypes[3] = 0 AND p1.pronargs > 3) OR + (p1.proargtypes[4] = 0 AND p1.pronargs > 4) OR + (p1.proargtypes[5] = 0 AND p1.pronargs > 5) OR + (p1.proargtypes[6] = 0 AND p1.pronargs > 6) OR + (p1.proargtypes[7] = 0 AND p1.pronargs > 7) OR + (p1.proargtypes[8] = 0 AND p1.pronargs > 8) OR + (p1.proargtypes[9] = 0 AND p1.pronargs > 9); oid | proname -----+--------- (0 rows) @@ -217,7 +224,7 @@ WHERE c.castfunc = 0 AND NOT c.castimplicit; SELECT * FROM pg_cast c WHERE c.castfunc = 0 AND - NOT EXISTS (SELECT * FROM pg_cast k + NOT EXISTS (SELECT 1 FROM pg_cast k WHERE k.castfunc = 0 AND k.castsource = c.casttarget AND k.casttarget = c.castsource); @@ -341,7 +348,7 @@ WHERE p1.oprlsortop != 0 AND SELECT p1.oid, p1.oprname FROM pg_operator AS p1 WHERE p1.oprlsortop != 0 AND NOT - EXISTS(SELECT * FROM pg_operator AS p2 WHERE + EXISTS(SELECT 1 FROM pg_operator AS p2 WHERE p2.oprname = '<' AND p2.oprleft = p1.oprleft AND p2.oprright = p1.oprright AND @@ -352,7 +359,7 @@ WHERE p1.oprlsortop != 0 AND NOT SELECT p1.oid, p1.oprname FROM pg_operator AS p1 WHERE p1.oprlsortop != 0 AND NOT - EXISTS(SELECT * FROM pg_operator AS p2 WHERE + EXISTS(SELECT 1 FROM pg_operator AS p2 WHERE p2.oprname = '>' AND p2.oprleft = p1.oprleft AND p2.oprright = p1.oprright AND @@ -468,15 +475,17 @@ WHERE p1.oprcode = p2.oid AND -- If oprrest is set, the operator must return boolean, -- and it must link to a proc with the right signature -- to be a restriction selectivity estimator. --- The proc signature we want is: float8 proc(opaque, oid, opaque, int4) +-- The proc signature we want is: float8 proc(internal, oid, internal, int4) SELECT p1.oid, p1.oprname, p2.oid, p2.proname FROM pg_operator AS p1, pg_proc AS p2 WHERE p1.oprrest = p2.oid AND (p1.oprresult != 'bool'::regtype OR p2.prorettype != 'float8'::regtype OR p2.proretset OR p2.pronargs != 4 OR - p2.proargtypes[0] != 0 OR p2.proargtypes[1] != 'oid'::regtype OR - p2.proargtypes[2] != 0 OR p2.proargtypes[3] != 'int4'::regtype); + p2.proargtypes[0] != 'internal'::regtype OR + p2.proargtypes[1] != 'oid'::regtype OR + p2.proargtypes[2] != 'internal'::regtype OR + p2.proargtypes[3] != 'int4'::regtype); oid | oprname | oid | proname -----+---------+-----+--------- (0 rows) @@ -484,15 +493,16 @@ WHERE p1.oprrest = p2.oid AND -- If oprjoin is set, the operator must be a binary boolean op, -- and it must link to a proc with the right signature -- to be a join selectivity estimator. --- The proc signature we want is: float8 proc(opaque, oid, opaque) +-- The proc signature we want is: float8 proc(internal, oid, internal) SELECT p1.oid, p1.oprname, p2.oid, p2.proname FROM pg_operator AS p1, pg_proc AS p2 WHERE p1.oprjoin = p2.oid AND (p1.oprkind != 'b' OR p1.oprresult != 'bool'::regtype OR p2.prorettype != 'float8'::regtype OR p2.proretset OR p2.pronargs != 3 OR - p2.proargtypes[0] != 0 OR p2.proargtypes[1] != 'oid'::regtype OR - p2.proargtypes[2] != 0); + p2.proargtypes[0] != 'internal'::regtype OR + p2.proargtypes[1] != 'oid'::regtype OR + p2.proargtypes[2] != 'internal'::regtype); oid | oprname | oid | proname -----+---------+-----+--------- (0 rows) @@ -547,7 +557,7 @@ WHERE a.aggfnoid = p.oid AND a.aggtranstype != p2.prorettype OR a.aggtranstype != p2.proargtypes[0] OR NOT ((p2.pronargs = 2 AND p.proargtypes[0] = p2.proargtypes[1]) OR - (p2.pronargs = 1 AND p.proargtypes[0] = 0))); + (p2.pronargs = 1 AND p.proargtypes[0] = '"any"'::regtype))); aggfnoid | proname | oid | proname ----------+---------+-----+------------- 2121 | max | 768 | int4larger diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out index 91d7c34b66330e5fb5eaec053883dfda3a03a5da..7682be33eb7cf0690a26b339f9c371a6d299739d 100644 --- a/src/test/regress/expected/plpgsql.out +++ b/src/test/regress/expected/plpgsql.out @@ -74,7 +74,7 @@ create unique index PHone_name on PHone using btree (slotname bpchar_ops); -- * AFTER UPDATE on Room -- * - If room no changes let wall slots follow -- ************************************************************ -create function tg_room_au() returns opaque as ' +create function tg_room_au() returns trigger as ' begin if new.roomno != old.roomno then update WSlot set roomno = new.roomno where roomno = old.roomno; @@ -88,7 +88,7 @@ create trigger tg_room_au after update -- * AFTER DELETE on Room -- * - delete wall slots in this room -- ************************************************************ -create function tg_room_ad() returns opaque as ' +create function tg_room_ad() returns trigger as ' begin delete from WSlot where roomno = old.roomno; return old; @@ -100,7 +100,7 @@ create trigger tg_room_ad after delete -- * BEFORE INSERT or UPDATE on WSlot -- * - Check that room exists -- ************************************************************ -create function tg_wslot_biu() returns opaque as ' +create function tg_wslot_biu() returns trigger as ' begin if count(*) = 0 from Room where roomno = new.roomno then raise exception ''Room % does not exist'', new.roomno; @@ -114,7 +114,7 @@ create trigger tg_wslot_biu before insert or update -- * AFTER UPDATE on PField -- * - Let PSlots of this field follow -- ************************************************************ -create function tg_pfield_au() returns opaque as ' +create function tg_pfield_au() returns trigger as ' begin if new.name != old.name then update PSlot set pfname = new.name where pfname = old.name; @@ -128,7 +128,7 @@ create trigger tg_pfield_au after update -- * AFTER DELETE on PField -- * - Remove all slots of this patchfield -- ************************************************************ -create function tg_pfield_ad() returns opaque as ' +create function tg_pfield_ad() returns trigger as ' begin delete from PSlot where pfname = old.name; return old; @@ -140,7 +140,7 @@ create trigger tg_pfield_ad after delete -- * BEFORE INSERT or UPDATE on PSlot -- * - Ensure that our patchfield does exist -- ************************************************************ -create function tg_pslot_biu() returns opaque as ' +create function tg_pslot_biu() returns trigger as ' declare pfrec record; rename new to ps; @@ -158,7 +158,7 @@ create trigger tg_pslot_biu before insert or update -- * AFTER UPDATE on System -- * - If system name changes let interfaces follow -- ************************************************************ -create function tg_system_au() returns opaque as ' +create function tg_system_au() returns trigger as ' begin if new.name != old.name then update IFace set sysname = new.name where sysname = old.name; @@ -172,7 +172,7 @@ create trigger tg_system_au after update -- * BEFORE INSERT or UPDATE on IFace -- * - set the slotname to IF.sysname.ifname -- ************************************************************ -create function tg_iface_biu() returns opaque as ' +create function tg_iface_biu() returns trigger as ' declare sname text; sysrec record; @@ -197,7 +197,7 @@ create trigger tg_iface_biu before insert or update -- * AFTER INSERT or UPDATE or DELETE on Hub -- * - insert/delete/rename slots as required -- ************************************************************ -create function tg_hub_a() returns opaque as ' +create function tg_hub_a() returns trigger as ' declare hname text; dummy integer; @@ -250,7 +250,7 @@ end; -- * - prevent from manual manipulation -- * - set the slotname to HS.hubname.slotno -- ************************************************************ -create function tg_hslot_biu() returns opaque as ' +create function tg_hslot_biu() returns trigger as ' declare sname text; xname HSlot.slotname%TYPE; @@ -286,7 +286,7 @@ create trigger tg_hslot_biu before insert or update -- * BEFORE DELETE on HSlot -- * - prevent from manual manipulation -- ************************************************************ -create function tg_hslot_bd() returns opaque as ' +create function tg_hslot_bd() returns trigger as ' declare hubrec record; begin @@ -306,7 +306,7 @@ create trigger tg_hslot_bd before delete -- * BEFORE INSERT on all slots -- * - Check name prefix -- ************************************************************ -create function tg_chkslotname() returns opaque as ' +create function tg_chkslotname() returns trigger as ' begin if substr(new.slotname, 1, 2) != tg_argv[0] then raise exception ''slotname must begin with %'', tg_argv[0]; @@ -328,7 +328,7 @@ create trigger tg_chkslotname before insert -- * BEFORE INSERT or UPDATE on all slots with slotlink -- * - Set slotlink to empty string if NULL value given -- ************************************************************ -create function tg_chkslotlink() returns opaque as ' +create function tg_chkslotlink() returns trigger as ' begin if new.slotlink isnull then new.slotlink := ''''; @@ -350,7 +350,7 @@ create trigger tg_chkslotlink before insert or update -- * BEFORE INSERT or UPDATE on all slots with backlink -- * - Set backlink to empty string if NULL value given -- ************************************************************ -create function tg_chkbacklink() returns opaque as ' +create function tg_chkbacklink() returns trigger as ' begin if new.backlink isnull then new.backlink := ''''; @@ -368,7 +368,7 @@ create trigger tg_chkbacklink before insert or update -- * BEFORE UPDATE on PSlot -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_pslot_bu() returns opaque as ' +create function tg_pslot_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from PSlot where slotname = old.slotname; @@ -394,7 +394,7 @@ create trigger tg_pslot_bu before update -- * BEFORE UPDATE on WSlot -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_wslot_bu() returns opaque as ' +create function tg_wslot_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from WSlot where slotname = old.slotname; @@ -420,7 +420,7 @@ create trigger tg_wslot_bu before update -- * BEFORE UPDATE on PLine -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_pline_bu() returns opaque as ' +create function tg_pline_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from PLine where slotname = old.slotname; @@ -446,7 +446,7 @@ create trigger tg_pline_bu before update -- * BEFORE UPDATE on IFace -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_iface_bu() returns opaque as ' +create function tg_iface_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from IFace where slotname = old.slotname; @@ -472,7 +472,7 @@ create trigger tg_iface_bu before update -- * BEFORE UPDATE on HSlot -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_hslot_bu() returns opaque as ' +create function tg_hslot_bu() returns trigger as ' begin if new.slotname != old.slotname or new.hubname != old.hubname then delete from HSlot where slotname = old.slotname; @@ -498,7 +498,7 @@ create trigger tg_hslot_bu before update -- * BEFORE UPDATE on PHone -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_phone_bu() returns opaque as ' +create function tg_phone_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from PHone where slotname = old.slotname; @@ -522,7 +522,7 @@ create trigger tg_phone_bu before update -- * AFTER INSERT or UPDATE or DELETE on slot with backlink -- * - Ensure that the opponent correctly points back to us -- ************************************************************ -create function tg_backlink_a() returns opaque as ' +create function tg_backlink_a() returns trigger as ' declare dummy integer; begin @@ -666,7 +666,7 @@ end; -- * AFTER INSERT or UPDATE or DELETE on slot with slotlink -- * - Ensure that the opponent correctly points back to us -- ************************************************************ -create function tg_slotlink_a() returns opaque as ' +create function tg_slotlink_a() returns trigger as ' declare dummy integer; begin diff --git a/src/test/regress/expected/type_sanity.out b/src/test/regress/expected/type_sanity.out index 68abfec74f3411e1cc274043e7b28a3360b76085..e0890fb01af955acbdb3696fdcfaeda2f42e8696 100644 --- a/src/test/regress/expected/type_sanity.out +++ b/src/test/regress/expected/type_sanity.out @@ -15,13 +15,12 @@ -- Look for illegal values in pg_type fields. SELECT p1.oid, p1.typname FROM pg_type as p1 -WHERE (p1.typlen <= 0 AND p1.typlen != -1) OR - p1.typtype not in('b', 'c', 'd', 'p') OR +WHERE p1.typnamespace = 0 OR + (p1.typlen <= 0 AND p1.typlen != -1) OR + (p1.typtype not in ('b', 'c', 'd', 'p')) OR NOT p1.typisdefined OR - (p1.typalign != 'c' AND p1.typalign != 's' AND - p1.typalign != 'i' AND p1.typalign != 'd') OR - (p1.typstorage != 'p' AND p1.typstorage != 'x' AND - p1.typstorage != 'e' AND p1.typstorage != 'm'); + (p1.typalign not in ('c', 's', 'i', 'd')) OR + (p1.typstorage not in ('p', 'x', 'e', 'm')); oid | typname -----+--------- (0 rows) @@ -91,27 +90,59 @@ WHERE p1.typtype != 'c' AND (0 rows) -- Check for bogus typinput routines --- FIXME: ought to check prorettype, but there are special cases that make it --- hard: prorettype might be binary-compatible with the type but not the same, --- and for array types array_in's result has nothing to do with anything. SELECT p1.oid, p1.typname, p2.oid, p2.proname FROM pg_type AS p1, pg_proc AS p2 -WHERE p1.typinput = p2.oid AND p1.typtype = 'b' AND - (p2.pronargs != 1 OR p2.proretset) AND - (p2.pronargs != 3 OR p2.proretset OR p2.proargtypes[2] != 'int4'::regtype); +WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + ((p2.pronargs = 1 AND p2.proargtypes[0] = 'cstring'::regtype) OR + (p2.pronargs = 3 AND p2.proargtypes[0] = 'cstring'::regtype AND + p2.proargtypes[1] = 'oid'::regtype AND + p2.proargtypes[2] = 'int4'::regtype)); + oid | typname | oid | proname +-----+---------+-----+--------- +(0 rows) + +-- As of 7.3, this check finds SET and refcursor, which are borrowing +-- other types' I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + (p1.typelem != 0 AND p1.typlen < 0) AND NOT + (p2.prorettype = p1.oid AND NOT p2.proretset); + oid | typname | oid | proname +------+-----------+-----+----------- + 32 | SET | 109 | unknownin + 1790 | refcursor | 46 | textin +(2 rows) + +-- Varlena array types will point to array_in +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND + (p1.typelem != 0 AND p1.typlen < 0) AND NOT + (p2.oid = 'array_in'::regproc); oid | typname | oid | proname -----+---------+-----+--------- (0 rows) -- Check for bogus typoutput routines --- The first OR subclause detects bogus non-array cases, --- the second one detects bogus array cases. --- FIXME: ought to check prorettype, but not clear what it should be. +-- As of 7.3, this check finds SET and refcursor, which are borrowing +-- other types' I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typoutput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + ((p2.pronargs = 1 AND p2.proargtypes[0] = p1.oid) OR + (p2.oid = 'array_out'::regproc AND + p1.typelem != 0)); + oid | typname | oid | proname +------+-----------+-----+------------ + 32 | SET | 110 | unknownout + 1790 | refcursor | 47 | textout +(2 rows) + SELECT p1.oid, p1.typname, p2.oid, p2.proname FROM pg_type AS p1, pg_proc AS p2 -WHERE p1.typoutput = p2.oid AND p1.typtype = 'b' AND - (p2.pronargs != 1 OR p2.proretset) AND - (p2.pronargs != 2 OR p2.proretset OR p1.typelem = 0); +WHERE p1.typoutput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + (p2.prorettype = 'cstring'::regtype AND NOT p2.proretset); oid | typname | oid | proname -----+---------+-----+--------- (0 rows) diff --git a/src/test/regress/input/create_function_1.source b/src/test/regress/input/create_function_1.source index 14ae6ff2bbb3cc7dd0c6caa2ab45d2974b31ca67..f657e3740cdd8571f86f9e5b4a4835988dba052c 100644 --- a/src/test/regress/input/create_function_1.source +++ b/src/test/regress/input/create_function_1.source @@ -2,38 +2,48 @@ -- CREATE_FUNCTION_1 -- -CREATE FUNCTION widget_in(opaque) +CREATE FUNCTION widget_in(cstring) RETURNS widget AS '@abs_builddir@/regress@DLSUFFIX@' LANGUAGE 'c'; -CREATE FUNCTION widget_out(opaque) - RETURNS opaque +CREATE FUNCTION widget_out(widget) + RETURNS cstring + AS '@abs_builddir@/regress@DLSUFFIX@' + LANGUAGE 'c'; + +CREATE FUNCTION int44in(cstring) + RETURNS city_budget + AS '@abs_builddir@/regress@DLSUFFIX@' + LANGUAGE 'c'; + +CREATE FUNCTION int44out(city_budget) + RETURNS cstring AS '@abs_builddir@/regress@DLSUFFIX@' LANGUAGE 'c'; CREATE FUNCTION check_primary_key () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/../../../contrib/spi/refint@DLSUFFIX@' LANGUAGE 'C'; CREATE FUNCTION check_foreign_key () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/../../../contrib/spi/refint@DLSUFFIX@' LANGUAGE 'C'; CREATE FUNCTION autoinc () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/../../../contrib/spi/autoinc@DLSUFFIX@' LANGUAGE 'C'; CREATE FUNCTION funny_dup17 () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/regress@DLSUFFIX@' LANGUAGE 'C'; CREATE FUNCTION ttdummy () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/regress@DLSUFFIX@' LANGUAGE 'C'; diff --git a/src/test/regress/output/create_function_1.source b/src/test/regress/output/create_function_1.source index 2c98b6c2eac342c0f20740be8a7cf14a8995f95a..9632114f93cb39e56b2793949b7328db39d4d2c5 100644 --- a/src/test/regress/output/create_function_1.source +++ b/src/test/regress/output/create_function_1.source @@ -1,33 +1,44 @@ -- -- CREATE_FUNCTION_1 -- -CREATE FUNCTION widget_in(opaque) +CREATE FUNCTION widget_in(cstring) RETURNS widget AS '@abs_builddir@/regress@DLSUFFIX@' LANGUAGE 'c'; WARNING: ProcedureCreate: type widget is not yet defined -CREATE FUNCTION widget_out(opaque) - RETURNS opaque +CREATE FUNCTION widget_out(widget) + RETURNS cstring AS '@abs_builddir@/regress@DLSUFFIX@' LANGUAGE 'c'; +WARNING: Argument type "widget" is only a shell +CREATE FUNCTION int44in(cstring) + RETURNS city_budget + AS '@abs_builddir@/regress@DLSUFFIX@' + LANGUAGE 'c'; +WARNING: ProcedureCreate: type city_budget is not yet defined +CREATE FUNCTION int44out(city_budget) + RETURNS cstring + AS '@abs_builddir@/regress@DLSUFFIX@' + LANGUAGE 'c'; +WARNING: Argument type "city_budget" is only a shell CREATE FUNCTION check_primary_key () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/../../../contrib/spi/refint@DLSUFFIX@' LANGUAGE 'C'; CREATE FUNCTION check_foreign_key () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/../../../contrib/spi/refint@DLSUFFIX@' LANGUAGE 'C'; CREATE FUNCTION autoinc () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/../../../contrib/spi/autoinc@DLSUFFIX@' LANGUAGE 'C'; CREATE FUNCTION funny_dup17 () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/regress@DLSUFFIX@' LANGUAGE 'C'; CREATE FUNCTION ttdummy () - RETURNS opaque + RETURNS trigger AS '@abs_builddir@/regress@DLSUFFIX@' LANGUAGE 'C'; CREATE FUNCTION set_ttdummy (int4) diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c index 3ef2c1b6db78ca0a4361be865376ab5ed093f0f8..2965dca69de4cfab4b218957c60cf2a050b942da 100644 --- a/src/test/regress/regress.c +++ b/src/test/regress/regress.c @@ -1,5 +1,5 @@ /* - * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.50 2002/03/06 06:10:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.51 2002/08/22 00:01:51 tgl Exp $ */ #include "postgres.h" @@ -26,6 +26,8 @@ extern Datum overpaid(PG_FUNCTION_ARGS); extern Datum boxarea(PG_FUNCTION_ARGS); extern char *reverse_name(char *string); extern int oldstyle_length(int n, text *t); +extern Datum int44in(PG_FUNCTION_ARGS); +extern Datum int44out(PG_FUNCTION_ARGS); /* ** Distance from a point to a path @@ -684,3 +686,61 @@ set_ttdummy(PG_FUNCTION_ARGS) PG_RETURN_INT32(1); } + + +/* + * Type int44 has no real-world use, but the regression tests use it. + * It's a four-element vector of int4's. + */ + +/* + * int44in - converts "num num ..." to internal form + * + * Note: Fills any missing positions with zeroes. + */ +PG_FUNCTION_INFO_V1(int44in); + +Datum +int44in(PG_FUNCTION_ARGS) +{ + char *input_string = PG_GETARG_CSTRING(0); + int32 *result = (int32 *) palloc(4 * sizeof(int32)); + int i; + + i = sscanf(input_string, + "%d, %d, %d, %d", + &result[0], + &result[1], + &result[2], + &result[3]); + while (i < 4) + result[i++] = 0; + + PG_RETURN_POINTER(result); +} + +/* + * int44out - converts internal form to "num num ..." + */ +PG_FUNCTION_INFO_V1(int44out); + +Datum +int44out(PG_FUNCTION_ARGS) +{ + int32 *an_array = (int32 *) PG_GETARG_POINTER(0); + char *result = (char *) palloc(16 * 4); /* Allow 14 digits + + * sign */ + int i; + char *walk; + + walk = result; + for (i = 0; i < 4; i++) + { + pg_ltoa(an_array[i], walk); + while (*++walk != '\0') + ; + *walk++ = ' '; + } + *--walk = '\0'; + PG_RETURN_CSTRING(result); +} diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql index 4f0d50247f182d3fbe3a22ae4d0bdce6f8d29886..72c52dba11363f0a4cc6df255b24a03075be0855 100644 --- a/src/test/regress/sql/copy2.sql +++ b/src/test/regress/sql/copy2.sql @@ -6,14 +6,14 @@ CREATE TABLE x ( e text ); -CREATE FUNCTION fn_x_before () RETURNS OPAQUE AS ' +CREATE FUNCTION fn_x_before () RETURNS TRIGGER AS ' BEGIN NEW.e := ''before trigger fired''::text; return NEW; END; ' language 'plpgsql'; -CREATE FUNCTION fn_x_after () RETURNS OPAQUE AS ' +CREATE FUNCTION fn_x_after () RETURNS TRIGGER AS ' BEGIN UPDATE x set e=''after trigger fired'' where c=''stuff''; return NULL; diff --git a/src/test/regress/sql/create_type.sql b/src/test/regress/sql/create_type.sql index 9b37981bd49c0e56fc46daaa48839ec0d18106fe..ddcba72624eedc8a5e3ca4d7c83523db959422ea 100644 --- a/src/test/regress/sql/create_type.sql +++ b/src/test/regress/sql/create_type.sql @@ -18,10 +18,28 @@ CREATE TYPE city_budget ( -- Test type-related default values (broken in releases before PG 7.2) +-- Make dummy I/O routines using the existing internal support for int4, text +CREATE FUNCTION int42_in(cstring) + RETURNS int42 + AS 'int4in' + LANGUAGE 'internal' WITH (isStrict); +CREATE FUNCTION int42_out(int42) + RETURNS cstring + AS 'int4out' + LANGUAGE 'internal' WITH (isStrict); +CREATE FUNCTION text_w_default_in(cstring) + RETURNS text_w_default + AS 'textin' + LANGUAGE 'internal' WITH (isStrict); +CREATE FUNCTION text_w_default_out(text_w_default) + RETURNS cstring + AS 'textout' + LANGUAGE 'internal' WITH (isStrict); + CREATE TYPE int42 ( internallength = 4, - input = int4in, - output = int4out, + input = int42_in, + output = int42_out, alignment = int4, default = 42, passedbyvalue @@ -29,8 +47,8 @@ CREATE TYPE int42 ( CREATE TYPE text_w_default ( internallength = variable, - input = textin, - output = textout, + input = text_w_default_in, + output = text_w_default_out, alignment = int4, default = 'zippo' ); diff --git a/src/test/regress/sql/drop.sql b/src/test/regress/sql/drop.sql index a466e6f7c21a70e8a39127ede3f26be4f8ea04ad..2b143d95bc7180371ab1a08ad4f5ca3d7281db73 100644 --- a/src/test/regress/sql/drop.sql +++ b/src/test/regress/sql/drop.sql @@ -24,9 +24,9 @@ DROP FUNCTION equipment(hobbies_r); DROP FUNCTION user_relns(); -DROP FUNCTION widget_in(opaque); +DROP FUNCTION widget_in(cstring); -DROP FUNCTION widget_out(opaque); +DROP FUNCTION widget_out(widget); DROP FUNCTION pt_in_widget(point,widget); diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql index 9d08dbd5bb37f2a780b47c6034e6243a38e91966..d9be98a5fd3d0b478d439858c51754d60334114d 100644 --- a/src/test/regress/sql/opr_sanity.sql +++ b/src/test/regress/sql/opr_sanity.sql @@ -18,17 +18,24 @@ -- **************** pg_proc **************** -- Look for illegal values in pg_proc fields. --- NOTE: currently there are a few pg_proc entries that have prorettype = 0. --- Someday that ought to be cleaned up. +-- NOTE: in reality pronargs could be more than 10, but I'm too lazy to put +-- a larger number of proargtypes check clauses in here. If we ever have +-- more-than-10-arg functions in the standard catalogs, extend this query. SELECT p1.oid, p1.proname FROM pg_proc as p1 -WHERE (p1.prolang = 0 OR p1.prorettype = 0 OR - p1.pronargs < 0 OR p1.pronargs > 16) - AND p1.proname !~ '^pl[^_]+_call_handler$' - AND p1.proname !~ '^RI_FKey_' - AND p1.proname !~ 'costestimate$' - AND p1.proname != 'update_pg_pwd_and_pg_group'; +WHERE p1.prolang = 0 OR p1.prorettype = 0 OR + p1.pronargs < 0 OR p1.pronargs > 10 OR + (p1.proargtypes[0] = 0 AND p1.pronargs > 0) OR + (p1.proargtypes[1] = 0 AND p1.pronargs > 1) OR + (p1.proargtypes[2] = 0 AND p1.pronargs > 2) OR + (p1.proargtypes[3] = 0 AND p1.pronargs > 3) OR + (p1.proargtypes[4] = 0 AND p1.pronargs > 4) OR + (p1.proargtypes[5] = 0 AND p1.pronargs > 5) OR + (p1.proargtypes[6] = 0 AND p1.pronargs > 6) OR + (p1.proargtypes[7] = 0 AND p1.pronargs > 7) OR + (p1.proargtypes[8] = 0 AND p1.pronargs > 8) OR + (p1.proargtypes[9] = 0 AND p1.pronargs > 9); -- Look for conflicting proc definitions (same names and input datatypes). -- (This test should be dead code now that we have the unique index @@ -174,7 +181,7 @@ WHERE c.castfunc = 0 AND NOT c.castimplicit; SELECT * FROM pg_cast c WHERE c.castfunc = 0 AND - NOT EXISTS (SELECT * FROM pg_cast k + NOT EXISTS (SELECT 1 FROM pg_cast k WHERE k.castfunc = 0 AND k.castsource = c.casttarget AND k.casttarget = c.castsource); @@ -279,7 +286,7 @@ WHERE p1.oprlsortop != 0 AND SELECT p1.oid, p1.oprname FROM pg_operator AS p1 WHERE p1.oprlsortop != 0 AND NOT - EXISTS(SELECT * FROM pg_operator AS p2 WHERE + EXISTS(SELECT 1 FROM pg_operator AS p2 WHERE p2.oprname = '<' AND p2.oprleft = p1.oprleft AND p2.oprright = p1.oprright AND @@ -287,7 +294,7 @@ WHERE p1.oprlsortop != 0 AND NOT SELECT p1.oid, p1.oprname FROM pg_operator AS p1 WHERE p1.oprlsortop != 0 AND NOT - EXISTS(SELECT * FROM pg_operator AS p2 WHERE + EXISTS(SELECT 1 FROM pg_operator AS p2 WHERE p2.oprname = '>' AND p2.oprleft = p1.oprleft AND p2.oprright = p1.oprright AND @@ -386,7 +393,7 @@ WHERE p1.oprcode = p2.oid AND -- If oprrest is set, the operator must return boolean, -- and it must link to a proc with the right signature -- to be a restriction selectivity estimator. --- The proc signature we want is: float8 proc(opaque, oid, opaque, int4) +-- The proc signature we want is: float8 proc(internal, oid, internal, int4) SELECT p1.oid, p1.oprname, p2.oid, p2.proname FROM pg_operator AS p1, pg_proc AS p2 @@ -394,13 +401,15 @@ WHERE p1.oprrest = p2.oid AND (p1.oprresult != 'bool'::regtype OR p2.prorettype != 'float8'::regtype OR p2.proretset OR p2.pronargs != 4 OR - p2.proargtypes[0] != 0 OR p2.proargtypes[1] != 'oid'::regtype OR - p2.proargtypes[2] != 0 OR p2.proargtypes[3] != 'int4'::regtype); + p2.proargtypes[0] != 'internal'::regtype OR + p2.proargtypes[1] != 'oid'::regtype OR + p2.proargtypes[2] != 'internal'::regtype OR + p2.proargtypes[3] != 'int4'::regtype); -- If oprjoin is set, the operator must be a binary boolean op, -- and it must link to a proc with the right signature -- to be a join selectivity estimator. --- The proc signature we want is: float8 proc(opaque, oid, opaque) +-- The proc signature we want is: float8 proc(internal, oid, internal) SELECT p1.oid, p1.oprname, p2.oid, p2.proname FROM pg_operator AS p1, pg_proc AS p2 @@ -408,8 +417,9 @@ WHERE p1.oprjoin = p2.oid AND (p1.oprkind != 'b' OR p1.oprresult != 'bool'::regtype OR p2.prorettype != 'float8'::regtype OR p2.proretset OR p2.pronargs != 3 OR - p2.proargtypes[0] != 0 OR p2.proargtypes[1] != 'oid'::regtype OR - p2.proargtypes[2] != 0); + p2.proargtypes[0] != 'internal'::regtype OR + p2.proargtypes[1] != 'oid'::regtype OR + p2.proargtypes[2] != 'internal'::regtype); -- **************** pg_aggregate **************** @@ -454,7 +464,7 @@ WHERE a.aggfnoid = p.oid AND a.aggtranstype != p2.prorettype OR a.aggtranstype != p2.proargtypes[0] OR NOT ((p2.pronargs = 2 AND p.proargtypes[0] = p2.proargtypes[1]) OR - (p2.pronargs = 1 AND p.proargtypes[0] = 0))); + (p2.pronargs = 1 AND p.proargtypes[0] = '"any"'::regtype))); -- Cross-check finalfn (if present) against its entry in pg_proc. -- FIXME: what about binary-compatible types? diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql index 618273823b31dfec5e48b042de1097727c090f7d..2f967c65ce49faa6b88fa32caf79e30ce265873b 100644 --- a/src/test/regress/sql/plpgsql.sql +++ b/src/test/regress/sql/plpgsql.sql @@ -107,7 +107,7 @@ create unique index PHone_name on PHone using btree (slotname bpchar_ops); -- * AFTER UPDATE on Room -- * - If room no changes let wall slots follow -- ************************************************************ -create function tg_room_au() returns opaque as ' +create function tg_room_au() returns trigger as ' begin if new.roomno != old.roomno then update WSlot set roomno = new.roomno where roomno = old.roomno; @@ -124,7 +124,7 @@ create trigger tg_room_au after update -- * AFTER DELETE on Room -- * - delete wall slots in this room -- ************************************************************ -create function tg_room_ad() returns opaque as ' +create function tg_room_ad() returns trigger as ' begin delete from WSlot where roomno = old.roomno; return old; @@ -139,7 +139,7 @@ create trigger tg_room_ad after delete -- * BEFORE INSERT or UPDATE on WSlot -- * - Check that room exists -- ************************************************************ -create function tg_wslot_biu() returns opaque as ' +create function tg_wslot_biu() returns trigger as ' begin if count(*) = 0 from Room where roomno = new.roomno then raise exception ''Room % does not exist'', new.roomno; @@ -156,7 +156,7 @@ create trigger tg_wslot_biu before insert or update -- * AFTER UPDATE on PField -- * - Let PSlots of this field follow -- ************************************************************ -create function tg_pfield_au() returns opaque as ' +create function tg_pfield_au() returns trigger as ' begin if new.name != old.name then update PSlot set pfname = new.name where pfname = old.name; @@ -173,7 +173,7 @@ create trigger tg_pfield_au after update -- * AFTER DELETE on PField -- * - Remove all slots of this patchfield -- ************************************************************ -create function tg_pfield_ad() returns opaque as ' +create function tg_pfield_ad() returns trigger as ' begin delete from PSlot where pfname = old.name; return old; @@ -188,7 +188,7 @@ create trigger tg_pfield_ad after delete -- * BEFORE INSERT or UPDATE on PSlot -- * - Ensure that our patchfield does exist -- ************************************************************ -create function tg_pslot_biu() returns opaque as ' +create function tg_pslot_biu() returns trigger as ' declare pfrec record; rename new to ps; @@ -209,7 +209,7 @@ create trigger tg_pslot_biu before insert or update -- * AFTER UPDATE on System -- * - If system name changes let interfaces follow -- ************************************************************ -create function tg_system_au() returns opaque as ' +create function tg_system_au() returns trigger as ' begin if new.name != old.name then update IFace set sysname = new.name where sysname = old.name; @@ -226,7 +226,7 @@ create trigger tg_system_au after update -- * BEFORE INSERT or UPDATE on IFace -- * - set the slotname to IF.sysname.ifname -- ************************************************************ -create function tg_iface_biu() returns opaque as ' +create function tg_iface_biu() returns trigger as ' declare sname text; sysrec record; @@ -254,7 +254,7 @@ create trigger tg_iface_biu before insert or update -- * AFTER INSERT or UPDATE or DELETE on Hub -- * - insert/delete/rename slots as required -- ************************************************************ -create function tg_hub_a() returns opaque as ' +create function tg_hub_a() returns trigger as ' declare hname text; dummy integer; @@ -312,7 +312,7 @@ end; -- * - prevent from manual manipulation -- * - set the slotname to HS.hubname.slotno -- ************************************************************ -create function tg_hslot_biu() returns opaque as ' +create function tg_hslot_biu() returns trigger as ' declare sname text; xname HSlot.slotname%TYPE; @@ -351,7 +351,7 @@ create trigger tg_hslot_biu before insert or update -- * BEFORE DELETE on HSlot -- * - prevent from manual manipulation -- ************************************************************ -create function tg_hslot_bd() returns opaque as ' +create function tg_hslot_bd() returns trigger as ' declare hubrec record; begin @@ -374,7 +374,7 @@ create trigger tg_hslot_bd before delete -- * BEFORE INSERT on all slots -- * - Check name prefix -- ************************************************************ -create function tg_chkslotname() returns opaque as ' +create function tg_chkslotname() returns trigger as ' begin if substr(new.slotname, 1, 2) != tg_argv[0] then raise exception ''slotname must begin with %'', tg_argv[0]; @@ -403,7 +403,7 @@ create trigger tg_chkslotname before insert -- * BEFORE INSERT or UPDATE on all slots with slotlink -- * - Set slotlink to empty string if NULL value given -- ************************************************************ -create function tg_chkslotlink() returns opaque as ' +create function tg_chkslotlink() returns trigger as ' begin if new.slotlink isnull then new.slotlink := ''''; @@ -432,7 +432,7 @@ create trigger tg_chkslotlink before insert or update -- * BEFORE INSERT or UPDATE on all slots with backlink -- * - Set backlink to empty string if NULL value given -- ************************************************************ -create function tg_chkbacklink() returns opaque as ' +create function tg_chkbacklink() returns trigger as ' begin if new.backlink isnull then new.backlink := ''''; @@ -455,7 +455,7 @@ create trigger tg_chkbacklink before insert or update -- * BEFORE UPDATE on PSlot -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_pslot_bu() returns opaque as ' +create function tg_pslot_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from PSlot where slotname = old.slotname; @@ -484,7 +484,7 @@ create trigger tg_pslot_bu before update -- * BEFORE UPDATE on WSlot -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_wslot_bu() returns opaque as ' +create function tg_wslot_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from WSlot where slotname = old.slotname; @@ -513,7 +513,7 @@ create trigger tg_wslot_bu before update -- * BEFORE UPDATE on PLine -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_pline_bu() returns opaque as ' +create function tg_pline_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from PLine where slotname = old.slotname; @@ -542,7 +542,7 @@ create trigger tg_pline_bu before update -- * BEFORE UPDATE on IFace -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_iface_bu() returns opaque as ' +create function tg_iface_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from IFace where slotname = old.slotname; @@ -571,7 +571,7 @@ create trigger tg_iface_bu before update -- * BEFORE UPDATE on HSlot -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_hslot_bu() returns opaque as ' +create function tg_hslot_bu() returns trigger as ' begin if new.slotname != old.slotname or new.hubname != old.hubname then delete from HSlot where slotname = old.slotname; @@ -600,7 +600,7 @@ create trigger tg_hslot_bu before update -- * BEFORE UPDATE on PHone -- * - do delete/insert instead of update if name changes -- ************************************************************ -create function tg_phone_bu() returns opaque as ' +create function tg_phone_bu() returns trigger as ' begin if new.slotname != old.slotname then delete from PHone where slotname = old.slotname; @@ -627,7 +627,7 @@ create trigger tg_phone_bu before update -- * AFTER INSERT or UPDATE or DELETE on slot with backlink -- * - Ensure that the opponent correctly points back to us -- ************************************************************ -create function tg_backlink_a() returns opaque as ' +create function tg_backlink_a() returns trigger as ' declare dummy integer; begin @@ -781,7 +781,7 @@ end; -- * AFTER INSERT or UPDATE or DELETE on slot with slotlink -- * - Ensure that the opponent correctly points back to us -- ************************************************************ -create function tg_slotlink_a() returns opaque as ' +create function tg_slotlink_a() returns trigger as ' declare dummy integer; begin diff --git a/src/test/regress/sql/type_sanity.sql b/src/test/regress/sql/type_sanity.sql index 5003ae6b165dc9c831eaa120b3623943f3b81a90..0a9701de827943e164b440697a07916292a0e293 100644 --- a/src/test/regress/sql/type_sanity.sql +++ b/src/test/regress/sql/type_sanity.sql @@ -18,13 +18,12 @@ SELECT p1.oid, p1.typname FROM pg_type as p1 -WHERE (p1.typlen <= 0 AND p1.typlen != -1) OR - p1.typtype not in('b', 'c', 'd', 'p') OR +WHERE p1.typnamespace = 0 OR + (p1.typlen <= 0 AND p1.typlen != -1) OR + (p1.typtype not in ('b', 'c', 'd', 'p')) OR NOT p1.typisdefined OR - (p1.typalign != 'c' AND p1.typalign != 's' AND - p1.typalign != 'i' AND p1.typalign != 'd') OR - (p1.typstorage != 'p' AND p1.typstorage != 'x' AND - p1.typstorage != 'e' AND p1.typstorage != 'm'); + (p1.typalign not in ('c', 's', 'i', 'd')) OR + (p1.typstorage not in ('p', 'x', 'e', 'm')); -- Look for "pass by value" types that can't be passed by value. @@ -76,26 +75,45 @@ WHERE p1.typtype != 'c' AND (p1.typinput = 0 OR p1.typoutput = 0); -- Check for bogus typinput routines --- FIXME: ought to check prorettype, but there are special cases that make it --- hard: prorettype might be binary-compatible with the type but not the same, --- and for array types array_in's result has nothing to do with anything. SELECT p1.oid, p1.typname, p2.oid, p2.proname FROM pg_type AS p1, pg_proc AS p2 -WHERE p1.typinput = p2.oid AND p1.typtype = 'b' AND - (p2.pronargs != 1 OR p2.proretset) AND - (p2.pronargs != 3 OR p2.proretset OR p2.proargtypes[2] != 'int4'::regtype); +WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + ((p2.pronargs = 1 AND p2.proargtypes[0] = 'cstring'::regtype) OR + (p2.pronargs = 3 AND p2.proargtypes[0] = 'cstring'::regtype AND + p2.proargtypes[1] = 'oid'::regtype AND + p2.proargtypes[2] = 'int4'::regtype)); + +-- As of 7.3, this check finds SET and refcursor, which are borrowing +-- other types' I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + (p1.typelem != 0 AND p1.typlen < 0) AND NOT + (p2.prorettype = p1.oid AND NOT p2.proretset); + +-- Varlena array types will point to array_in +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND + (p1.typelem != 0 AND p1.typlen < 0) AND NOT + (p2.oid = 'array_in'::regproc); -- Check for bogus typoutput routines --- The first OR subclause detects bogus non-array cases, --- the second one detects bogus array cases. --- FIXME: ought to check prorettype, but not clear what it should be. + +-- As of 7.3, this check finds SET and refcursor, which are borrowing +-- other types' I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typoutput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + ((p2.pronargs = 1 AND p2.proargtypes[0] = p1.oid) OR + (p2.oid = 'array_out'::regproc AND + p1.typelem != 0)); SELECT p1.oid, p1.typname, p2.oid, p2.proname FROM pg_type AS p1, pg_proc AS p2 -WHERE p1.typoutput = p2.oid AND p1.typtype = 'b' AND - (p2.pronargs != 1 OR p2.proretset) AND - (p2.pronargs != 2 OR p2.proretset OR p1.typelem = 0); +WHERE p1.typoutput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + (p2.prorettype = 'cstring'::regtype AND NOT p2.proretset); -- **************** pg_class **************** diff --git a/src/tutorial/complex.c b/src/tutorial/complex.c index 2dd4e6e6078f9135952e4e6a54bcf86b481a8927..b95baa2be0e8cc3188c8237d84885fe821a1d588 100644 --- a/src/tutorial/complex.c +++ b/src/tutorial/complex.c @@ -48,14 +48,6 @@ complex_in(char *str) return result; } -/* - * You might have noticed a slight inconsistency between the following - * declaration and the SQL definition: - * CREATE FUNCTION complex_out(opaque) RETURNS opaque ... - * The reason is that the argument pass into complex_out is really just a - * pointer. POSTGRES thinks all output functions are: - * char *out_func(char *); - */ char * complex_out(Complex * complex) { @@ -64,8 +56,8 @@ complex_out(Complex * complex) if (complex == NULL) return NULL; - result = (char *) palloc(60); - sprintf(result, "(%g,%g)", complex->x, complex->y); + result = (char *) palloc(100); + snprintf(result, 100, "(%g,%g)", complex->x, complex->y); return result; } diff --git a/src/tutorial/complex.source b/src/tutorial/complex.source index 5df3c5d6779c29a4b81d71e25769cf918b3c62a9..382eea25e9f5f82834b5db8b5ac89a07c49c06e9 100644 --- a/src/tutorial/complex.source +++ b/src/tutorial/complex.source @@ -8,7 +8,7 @@ -- Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group -- Portions Copyright (c) 1994, Regents of the University of California -- --- $Header: /cvsroot/pgsql/src/tutorial/complex.source,v 1.13 2002/07/30 05:24:56 tgl Exp $ +-- $Header: /cvsroot/pgsql/src/tutorial/complex.source,v 1.14 2002/08/22 00:01:51 tgl Exp $ -- --------------------------------------------------------------------------- @@ -28,7 +28,7 @@ -- (in memory) representation. You will get a message telling you 'complex' -- does not exist yet but that's okay. -CREATE FUNCTION complex_in(opaque) +CREATE FUNCTION complex_in(cstring) RETURNS complex AS '_OBJWD_/complex' LANGUAGE 'c'; @@ -36,8 +36,8 @@ CREATE FUNCTION complex_in(opaque) -- the output function 'complex_out' takes the internal representation and -- converts it into the textual representation. -CREATE FUNCTION complex_out(opaque) - RETURNS opaque +CREATE FUNCTION complex_out(complex) + RETURNS cstring AS '_OBJWD_/complex' LANGUAGE 'c'; @@ -195,4 +195,3 @@ SELECT * from test_complex where a > '(56.0,-22.5)'; -- clean up the example DROP TABLE test_complex; DROP TYPE complex CASCADE; -DROP FUNCTION complex_out(opaque);