Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2b23bf3

Browse files
committed
Fix built-in SQL-language functions to ensure that referenced names
are properly schema-qualified. Christopher Kings-Lynne
1 parent d4273a5 commit 2b23bf3

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

src/include/catalog/catversion.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $Id: catversion.h,v 1.209 2003/10/20 21:39:37 petere Exp $
40+
* $Id: catversion.h,v 1.210 2003/10/21 16:23:16 tgl Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 200310201
56+
#define CATALOG_VERSION_NO 200310211
5757

5858
#endif

src/include/catalog/pg_proc.h

+24-24
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_proc.h,v 1.313 2003/08/17 19:58:06 tgl Exp $
10+
* $Id: pg_proc.h,v 1.314 2003/10/21 16:23:16 tgl Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -1477,7 +1477,7 @@ DATA(insert OID = 1173 ( timestamptz PGNSP PGUID 12 f f t f s 1 1184 "702" a
14771477
DESCR("convert abstime to timestamp with time zone");
14781478
DATA(insert OID = 1174 ( timestamptz PGNSP PGUID 12 f f t f s 1 1184 "1082" date_timestamptz - _null_ ));
14791479
DESCR("convert date to timestamp with time zone");
1480-
DATA(insert OID = 1176 ( timestamptz PGNSP PGUID 14 f f t f s 2 1184 "1082 1083" "select timestamptz($1 + $2)" - _null_ ));
1480+
DATA(insert OID = 1176 ( timestamptz PGNSP PGUID 14 f f t f s 2 1184 "1082 1083" "select cast(($1 + $2) as timestamp with time zone)" - _null_ ));
14811481
DESCR("convert date and time to timestamp with time zone");
14821482
DATA(insert OID = 1177 ( interval PGNSP PGUID 12 f f t f i 1 1186 "703" reltime_interval - _null_ ));
14831483
DESCR("convert reltime to interval");
@@ -1520,9 +1520,9 @@ DESCR("date difference preserving months and years");
15201520
DATA(insert OID = 1200 ( interval PGNSP PGUID 12 f f t f i 2 1186 "1186 23" interval_scale - _null_ ));
15211521
DESCR("adjust interval precision");
15221522

1523-
DATA(insert OID = 1215 ( obj_description PGNSP PGUID 14 f f t f s 2 25 "26 19" "select description from pg_description where objoid = $1 and classoid = (select oid from pg_class where relname = $2 and relnamespace = PGNSP) and objsubid = 0" - _null_ ));
1523+
DATA(insert OID = 1215 ( obj_description PGNSP PGUID 14 f f t f s 2 25 "26 19" "select description from pg_catalog.pg_description where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP) and objsubid = 0" - _null_ ));
15241524
DESCR("get description for object id and catalog name");
1525-
DATA(insert OID = 1216 ( col_description PGNSP PGUID 14 f f t f s 2 25 "26 23" "select description from pg_description where objoid = $1 and classoid = \'pg_catalog.pg_class\'::regclass and objsubid = $2" - _null_ ));
1525+
DATA(insert OID = 1216 ( col_description PGNSP PGUID 14 f f t f s 2 25 "26 23" "select description from pg_catalog.pg_description where objoid = $1 and classoid = \'pg_catalog.pg_class\'::regclass and objsubid = $2" - _null_ ));
15261526
DESCR("get description for table column");
15271527

15281528
DATA(insert OID = 1217 ( date_trunc PGNSP PGUID 12 f f t f i 2 1184 "25 1184" timestamptz_trunc - _null_ ));
@@ -1683,7 +1683,7 @@ DESCR("exponential");
16831683
* This form of obj_description is now deprecated, since it will fail if
16841684
* OIDs are not unique across system catalogs. Use the other forms instead.
16851685
*/
1686-
DATA(insert OID = 1348 ( obj_description PGNSP PGUID 14 f f t f s 1 25 "26" "select description from pg_description where objoid = $1 and objsubid = 0" - _null_ ));
1686+
DATA(insert OID = 1348 ( obj_description PGNSP PGUID 14 f f t f s 1 25 "26" "select description from pg_catalog.pg_description where objoid = $1 and objsubid = 0" - _null_ ));
16871687
DESCR("get description for object id (deprecated)");
16881688
DATA(insert OID = 1349 ( oidvectortypes PGNSP PGUID 12 f f t f s 1 25 "30" oidvectortypes - _null_ ));
16891689
DESCR("print type names of oidvector field");
@@ -1740,15 +1740,15 @@ DESCR("smaller of two");
17401740
DATA(insert OID = 1381 ( char_length PGNSP PGUID 12 f f t f i 1 23 "25" textlen - _null_ ));
17411741
DESCR("character length");
17421742

1743-
DATA(insert OID = 1382 ( date_part PGNSP PGUID 14 f f t f s 2 701 "25 702" "select date_part($1, timestamptz($2))" - _null_ ));
1743+
DATA(insert OID = 1382 ( date_part PGNSP PGUID 14 f f t f s 2 701 "25 702" "select pg_catalog.date_part($1, cast($2 as timestamp with time zone))" - _null_ ));
17441744
DESCR("extract field from abstime");
1745-
DATA(insert OID = 1383 ( date_part PGNSP PGUID 14 f f t f s 2 701 "25 703" "select date_part($1, cast($2 as interval))" - _null_ ));
1745+
DATA(insert OID = 1383 ( date_part PGNSP PGUID 14 f f t f s 2 701 "25 703" "select pg_catalog.date_part($1, cast($2 as pg_catalog.interval))" - _null_ ));
17461746
DESCR("extract field from reltime");
1747-
DATA(insert OID = 1384 ( date_part PGNSP PGUID 14 f f t f i 2 701 "25 1082" "select date_part($1, cast($2 as timestamp without time zone))" - _null_ ));
1747+
DATA(insert OID = 1384 ( date_part PGNSP PGUID 14 f f t f i 2 701 "25 1082" "select pg_catalog.date_part($1, cast($2 as timestamp without time zone))" - _null_ ));
17481748
DESCR("extract field from date");
17491749
DATA(insert OID = 1385 ( date_part PGNSP PGUID 12 f f t f i 2 701 "25 1083" time_part - _null_ ));
17501750
DESCR("extract field from time");
1751-
DATA(insert OID = 1386 ( age PGNSP PGUID 14 f f t f s 1 1186 "1184" "select age(cast(current_date as timestamp with time zone), $1)" - _null_ ));
1751+
DATA(insert OID = 1386 ( age PGNSP PGUID 14 f f t f s 1 1186 "1184" "select pg_catalog.age(cast(current_date as timestamp with time zone), $1)" - _null_ ));
17521752
DESCR("date difference from today preserving months and years");
17531753

17541754
DATA(insert OID = 1388 ( timetz PGNSP PGUID 12 f f t f s 1 1266 "1184" timestamptz_timetz - _null_ ));
@@ -1789,9 +1789,9 @@ DESCR("current schema name");
17891789
DATA(insert OID = 1403 ( current_schemas PGNSP PGUID 12 f f t f s 1 1003 "16" current_schemas - _null_ ));
17901790
DESCR("current schema search list");
17911791

1792-
DATA(insert OID = 1404 ( overlay PGNSP PGUID 14 f f t f i 4 25 "25 25 23 23" "select substring($1, 1, ($3 - 1)) || $2 || substring($1, ($3 + $4))" - _null_ ));
1792+
DATA(insert OID = 1404 ( overlay PGNSP PGUID 14 f f t f i 4 25 "25 25 23 23" "select pg_catalog.substring($1, 1, ($3 - 1)) || $2 || pg_catalog.substring($1, ($3 + $4))" - _null_ ));
17931793
DESCR("substitute portion of string");
1794-
DATA(insert OID = 1405 ( overlay PGNSP PGUID 14 f f t f i 3 25 "25 25 23" "select substring($1, 1, ($3 - 1)) || $2 || substring($1, ($3 + char_length($2)))" - _null_ ));
1794+
DATA(insert OID = 1405 ( overlay PGNSP PGUID 14 f f t f i 3 25 "25 25 23" "select pg_catalog.substring($1, 1, ($3 - 1)) || $2 || pg_catalog.substring($1, ($3 + pg_catalog.char_length($2)))" - _null_ ));
17951795
DESCR("substitute portion of string");
17961796

17971797
DATA(insert OID = 1406 ( isvertical PGNSP PGUID 12 f f t f i 2 16 "600 600" point_vert - _null_ ));
@@ -1835,7 +1835,7 @@ DATA(insert OID = 1424 ( box_mul PGNSP PGUID 12 f f t f i 2 603 "603 600" box
18351835
DESCR("multiply box by point (scale)");
18361836
DATA(insert OID = 1425 ( box_div PGNSP PGUID 12 f f t f i 2 603 "603 600" box_div - _null_ ));
18371837
DESCR("divide box by point (scale)");
1838-
DATA(insert OID = 1426 ( path_contain_pt PGNSP PGUID 14 f f t f i 2 16 "602 600" "select on_ppath($2, $1)" - _null_ ));
1838+
DATA(insert OID = 1426 ( path_contain_pt PGNSP PGUID 14 f f t f i 2 16 "602 600" "select pg_catalog.on_ppath($2, $1)" - _null_ ));
18391839
DESCR("path contains point?");
18401840
DATA(insert OID = 1428 ( poly_contain_pt PGNSP PGUID 12 f f t f i 2 16 "604 600" poly_contain_pt - _null_ ));
18411841
DESCR("polygon contains point?");
@@ -2015,7 +2015,7 @@ DATA(insert OID = 1542 ( center PGNSP PGUID 12 f f t f i 1 600 "603" box_cent
20152015
DESCR("center of");
20162016
DATA(insert OID = 1543 ( center PGNSP PGUID 12 f f t f i 1 600 "718" circle_center - _null_ ));
20172017
DESCR("center of");
2018-
DATA(insert OID = 1544 ( polygon PGNSP PGUID 14 f f t f i 1 604 "718" "select polygon(12, $1)" - _null_ ));
2018+
DATA(insert OID = 1544 ( polygon PGNSP PGUID 14 f f t f i 1 604 "718" "select pg_catalog.polygon(12, $1)" - _null_ ));
20192019
DESCR("convert circle to 12-vertex polygon");
20202020
DATA(insert OID = 1545 ( npoints PGNSP PGUID 12 f f t f i 1 23 "602" path_npoints - _null_ ));
20212021
DESCR("number of points in path");
@@ -2165,9 +2165,9 @@ DATA(insert OID = 877 ( substr PGNSP PGUID 12 f f t f i 3 25 "25 23 23" te
21652165
DESCR("return portion of string");
21662166
DATA(insert OID = 878 ( translate PGNSP PGUID 12 f f t f i 3 25 "25 25 25" translate - _null_ ));
21672167
DESCR("map a set of character appearing in string");
2168-
DATA(insert OID = 879 ( lpad PGNSP PGUID 14 f f t f i 2 25 "25 23" "select lpad($1, $2, \' \')" - _null_ ));
2168+
DATA(insert OID = 879 ( lpad PGNSP PGUID 14 f f t f i 2 25 "25 23" "select pg_catalog.lpad($1, $2, \' \')" - _null_ ));
21692169
DESCR("left-pad string to length");
2170-
DATA(insert OID = 880 ( rpad PGNSP PGUID 14 f f t f i 2 25 "25 23" "select rpad($1, $2, \' \')" - _null_ ));
2170+
DATA(insert OID = 880 ( rpad PGNSP PGUID 14 f f t f i 2 25 "25 23" "select pg_catalog.rpad($1, $2, \' \')" - _null_ ));
21712171
DESCR("right-pad string to length");
21722172
DATA(insert OID = 881 ( ltrim PGNSP PGUID 12 f f t f i 1 25 "25" ltrim1 - _null_ ));
21732173
DESCR("trim spaces from left end of string");
@@ -2315,7 +2315,7 @@ DESCR("adjust varbit() to typmod length");
23152315

23162316
DATA(insert OID = 1698 ( position PGNSP PGUID 12 f f t f i 2 23 "1560 1560" bitposition - _null_ ));
23172317
DESCR("return position of sub-bitstring");
2318-
DATA(insert OID = 1699 ( substring PGNSP PGUID 14 f f t f i 2 1560 "1560 23" "select substring($1, $2, -1)" - _null_ ));
2318+
DATA(insert OID = 1699 ( substring PGNSP PGUID 14 f f t f i 2 1560 "1560 23" "select pg_catalog.substring($1, $2, -1)" - _null_ ));
23192319
DESCR("return portion of bitstring");
23202320

23212321

@@ -2445,11 +2445,11 @@ DATA(insert OID = 1706 ( sign PGNSP PGUID 12 f f t f i 1 1700 "1700" numeric
24452445
DESCR("sign of value");
24462446
DATA(insert OID = 1707 ( round PGNSP PGUID 12 f f t f i 2 1700 "1700 23" numeric_round - _null_ ));
24472447
DESCR("value rounded to 'scale'");
2448-
DATA(insert OID = 1708 ( round PGNSP PGUID 14 f f t f i 1 1700 "1700" "select round($1,0)" - _null_ ));
2448+
DATA(insert OID = 1708 ( round PGNSP PGUID 14 f f t f i 1 1700 "1700" "select pg_catalog.round($1,0)" - _null_ ));
24492449
DESCR("value rounded to 'scale' of zero");
24502450
DATA(insert OID = 1709 ( trunc PGNSP PGUID 12 f f t f i 2 1700 "1700 23" numeric_trunc - _null_ ));
24512451
DESCR("value truncated to 'scale'");
2452-
DATA(insert OID = 1710 ( trunc PGNSP PGUID 14 f f t f i 1 1700 "1700" "select trunc($1,0)" - _null_ ));
2452+
DATA(insert OID = 1710 ( trunc PGNSP PGUID 14 f f t f i 1 1700 "1700" "select pg_catalog.trunc($1,0)" - _null_ ));
24532453
DESCR("value truncated to 'scale' of zero");
24542454
DATA(insert OID = 1711 ( ceil PGNSP PGUID 12 f f t f i 1 1700 "1700" numeric_ceil - _null_ ));
24552455
DESCR("smallest integer >= value");
@@ -2501,7 +2501,7 @@ DATA(insert OID = 1739 ( numeric_power PGNSP PGUID 12 f f t f i 2 1700 "1700 1
25012501
DESCR("m raised to the power of n");
25022502
DATA(insert OID = 1740 ( numeric PGNSP PGUID 12 f f t f i 1 1700 "23" int4_numeric - _null_ ));
25032503
DESCR("(internal)");
2504-
DATA(insert OID = 1741 ( log PGNSP PGUID 14 f f t f i 1 1700 "1700" "select log(10, $1)" - _null_ ));
2504+
DATA(insert OID = 1741 ( log PGNSP PGUID 14 f f t f i 1 1700 "1700" "select pg_catalog.log(10, $1)" - _null_ ));
25052505
DESCR("logarithm base 10 of n");
25062506
DATA(insert OID = 1742 ( numeric PGNSP PGUID 12 f f t f i 1 1700 "700" float4_numeric - _null_ ));
25072507
DESCR("(internal)");
@@ -2575,11 +2575,11 @@ DATA(insert OID = 1799 ( oidout PGNSP PGUID 12 f f t f i 1 2275 "26" oidout
25752575
DESCR("I/O");
25762576

25772577

2578-
DATA(insert OID = 1810 ( bit_length PGNSP PGUID 14 f f t f i 1 23 "17" "select octet_length($1) * 8" - _null_ ));
2578+
DATA(insert OID = 1810 ( bit_length PGNSP PGUID 14 f f t f i 1 23 "17" "select pg_catalog.octet_length($1) * 8" - _null_ ));
25792579
DESCR("length in bits");
2580-
DATA(insert OID = 1811 ( bit_length PGNSP PGUID 14 f f t f i 1 23 "25" "select octet_length($1) * 8" - _null_ ));
2580+
DATA(insert OID = 1811 ( bit_length PGNSP PGUID 14 f f t f i 1 23 "25" "select pg_catalog.octet_length($1) * 8" - _null_ ));
25812581
DESCR("length in bits");
2582-
DATA(insert OID = 1812 ( bit_length PGNSP PGUID 14 f f t f i 1 23 "1560" "select length($1)" - _null_ ));
2582+
DATA(insert OID = 1812 ( bit_length PGNSP PGUID 14 f f t f i 1 23 "1560" "select pg_catalog.length($1)" - _null_ ));
25832583
DESCR("length in bits");
25842584

25852585
/* Selectivity estimators for LIKE and related operators */
@@ -2936,7 +2936,7 @@ DATA(insert OID = 2057 ( timestamp_gt PGNSP PGUID 12 f f t f i 2 16 "1114 1114
29362936
DESCR("greater-than");
29372937
DATA(insert OID = 2058 ( age PGNSP PGUID 12 f f t f i 2 1186 "1114 1114" timestamp_age - _null_ ));
29382938
DESCR("date difference preserving months and years");
2939-
DATA(insert OID = 2059 ( age PGNSP PGUID 14 f f t f s 1 1186 "1114" "select age(cast(current_date as timestamp without time zone), $1)" - _null_ ));
2939+
DATA(insert OID = 2059 ( age PGNSP PGUID 14 f f t f s 1 1186 "1114" "select pg_catalog.age(cast(current_date as timestamp without time zone), $1)" - _null_ ));
29402940
DESCR("date difference from today preserving months and years");
29412941

29422942
DATA(insert OID = 2069 ( timezone PGNSP PGUID 12 f f t f s 2 1184 "25 1114" timestamp_zone - _null_ ));
@@ -2950,7 +2950,7 @@ DESCR("subtract");
29502950

29512951
DATA(insert OID = 2073 ( substring PGNSP PGUID 12 f f t f i 2 25 "25 25" textregexsubstr - _null_ ));
29522952
DESCR("extracts text matching regular expression");
2953-
DATA(insert OID = 2074 ( substring PGNSP PGUID 14 f f t f i 3 25 "25 25 25" "select substring($1, similar_escape($2, $3))" - _null_ ));
2953+
DATA(insert OID = 2074 ( substring PGNSP PGUID 14 f f t f i 3 25 "25 25 25" "select pg_catalog.substring($1, pg_catalog.similar_escape($2, $3))" - _null_ ));
29542954
DESCR("extracts text matching SQL99 regular expression");
29552955

29562956
DATA(insert OID = 2075 ( bit PGNSP PGUID 12 f f t f i 1 1560 "20" bitfromint8 - _null_ ));

0 commit comments

Comments
 (0)