Skip to content

Commit 8c032ad

Browse files
committed
Convert remaining builtin set-returning functions to use OUT parameters, making
it possible to call them without specifying a column list. Jaime Casanova
1 parent 31ad4e5 commit 8c032ad

File tree

4 files changed

+18
-28
lines changed

4 files changed

+18
-28
lines changed

src/backend/catalog/system_views.sql

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 1996-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.53 2008/07/14 00:51:45 tgl Exp $
6+
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.54 2008/08/25 11:18:43 mha Exp $
77
*/
88

99
CREATE VIEW pg_roles AS
@@ -143,37 +143,27 @@ REVOKE ALL on pg_statistic FROM public;
143143

144144
CREATE VIEW pg_locks AS
145145
SELECT *
146-
FROM pg_lock_status() AS L
147-
(locktype text, database oid, relation oid, page int4, tuple int2,
148-
virtualxid text, transactionid xid, classid oid, objid oid, objsubid int2,
149-
virtualtransaction text, pid int4, mode text, granted boolean);
146+
FROM pg_lock_status() AS L;
150147

151148
CREATE VIEW pg_cursors AS
152149
SELECT C.name, C.statement, C.is_holdable, C.is_binary,
153150
C.is_scrollable, C.creation_time
154-
FROM pg_cursor() AS C
155-
(name text, statement text, is_holdable boolean, is_binary boolean,
156-
is_scrollable boolean, creation_time timestamptz);
151+
FROM pg_cursor() AS C;
157152

158153
CREATE VIEW pg_prepared_xacts AS
159154
SELECT P.transaction, P.gid, P.prepared,
160155
U.rolname AS owner, D.datname AS database
161156
FROM pg_prepared_xact() AS P
162-
(transaction xid, gid text, prepared timestamptz, ownerid oid, dbid oid)
163157
LEFT JOIN pg_authid U ON P.ownerid = U.oid
164158
LEFT JOIN pg_database D ON P.dbid = D.oid;
165159

166160
CREATE VIEW pg_prepared_statements AS
167161
SELECT P.name, P.statement, P.prepare_time, P.parameter_types, P.from_sql
168-
FROM pg_prepared_statement() AS P
169-
(name text, statement text, prepare_time timestamptz,
170-
parameter_types regtype[], from_sql boolean);
162+
FROM pg_prepared_statement() AS P;
171163

172164
CREATE VIEW pg_settings AS
173165
SELECT *
174-
FROM pg_show_all_settings() AS A
175-
(name text, setting text, unit text, category text, short_desc text, extra_desc text,
176-
context text, vartype text, source text, min_val text, max_val text, enumvals text);
166+
FROM pg_show_all_settings() AS A;
177167

178168
CREATE RULE pg_settings_u AS
179169
ON UPDATE TO pg_settings

src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.479 2008/08/23 20:31:37 momjian Exp $
40+
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.480 2008/08/25 11:18:43 mha Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 200808231
56+
#define CATALOG_VERSION_NO 200808251
5757

5858
#endif

src/include/catalog/pg_proc.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.511 2008/08/23 20:31:37 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.512 2008/08/25 11:18:43 mha Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -3157,11 +3157,11 @@ DATA(insert OID = 2077 ( current_setting PGNSP PGUID 12 1 0 0 f f t f s 1 25 "2
31573157
DESCR("SHOW X as a function");
31583158
DATA(insert OID = 2078 ( set_config PGNSP PGUID 12 1 0 0 f f f f v 3 25 "25 25 16" _null_ _null_ _null_ set_config_by_name _null_ _null_ _null_ ));
31593159
DESCR("SET X as a function");
3160-
DATA(insert OID = 2084 ( pg_show_all_settings PGNSP PGUID 12 1 1000 0 f f t t s 0 2249 "" _null_ _null_ _null_ show_all_settings _null_ _null_ _null_ ));
3160+
DATA(insert OID = 2084 ( pg_show_all_settings PGNSP PGUID 12 1 1000 0 f f t t s 0 2249 "" "{25,25,25,25,25,25,25,25,25,25,25,25}" "{o,o,o,o,o,o,o,o,o,o,o,o}" "{name,setting,unit,category,short_desc,extra_desc,context,vartype,source,min_val,max_val,enumvals}" show_all_settings _null_ _null_ _null_ ));
31613161
DESCR("SHOW ALL as a function");
3162-
DATA(insert OID = 1371 ( pg_lock_status PGNSP PGUID 12 1 1000 0 f f t t v 0 2249 "" _null_ _null_ _null_ pg_lock_status _null_ _null_ _null_ ));
3162+
DATA(insert OID = 1371 ( pg_lock_status PGNSP PGUID 12 1 1000 0 f f t t v 0 2249 "" "{25,26,26,23,21,25,28,26,26,21,25,23,25,16}" "{o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{locktype,database,relation,page,tuple,virtualxid,transactionid,classid,objid,objsubid,virtualtransaction,pid,mode,granted}" pg_lock_status _null_ _null_ _null_ ));
31633163
DESCR("view system lock information");
3164-
DATA(insert OID = 1065 ( pg_prepared_xact PGNSP PGUID 12 1 1000 0 f f t t v 0 2249 "" _null_ _null_ _null_ pg_prepared_xact _null_ _null_ _null_ ));
3164+
DATA(insert OID = 1065 ( pg_prepared_xact PGNSP PGUID 12 1 1000 0 f f t t v 0 2249 "" "{28,25,1184,26,26}" "{o,o,o,o,o}" "{transaction,gid,prepared,ownerid,dbid}" pg_prepared_xact _null_ _null_ _null_ ));
31653165
DESCR("view two-phase transactions");
31663166

31673167
DATA(insert OID = 2079 ( pg_table_is_visible PGNSP PGUID 12 1 0 0 f f t f s 1 16 "26" _null_ _null_ _null_ pg_table_is_visible _null_ _null_ _null_ ));
@@ -3975,9 +3975,9 @@ DATA(insert OID = 2508 ( pg_get_constraintdef PGNSP PGUID 12 1 0 0 f f t f s 2
39753975
DESCR("constraint description with pretty-print option");
39763976
DATA(insert OID = 2509 ( pg_get_expr PGNSP PGUID 12 1 0 0 f f t f s 3 25 "25 26 16" _null_ _null_ _null_ pg_get_expr_ext _null_ _null_ _null_ ));
39773977
DESCR("deparse an encoded expression with pretty-print option");
3978-
DATA(insert OID = 2510 ( pg_prepared_statement PGNSP PGUID 12 1 1000 0 f f t t s 0 2249 "" _null_ _null_ _null_ pg_prepared_statement _null_ _null_ _null_ ));
3978+
DATA(insert OID = 2510 ( pg_prepared_statement PGNSP PGUID 12 1 1000 0 f f t t s 0 2249 "" "{25,25,1184,2211,16}" "{o,o,o,o,o}" "{name,statement,prepare_time,parameter_types,from_sql}" pg_prepared_statement _null_ _null_ _null_ ));
39793979
DESCR("get the prepared statements for this session");
3980-
DATA(insert OID = 2511 ( pg_cursor PGNSP PGUID 12 1 1000 0 f f t t s 0 2249 "" _null_ _null_ _null_ pg_cursor _null_ _null_ _null_ ));
3980+
DATA(insert OID = 2511 ( pg_cursor PGNSP PGUID 12 1 1000 0 f f t t s 0 2249 "" "{25,25,16,16,16,1184}" "{o,o,o,o,o,o}" "{name,statement,is_holdable,is_binary,is_scrollable,creation_time}" pg_cursor _null_ _null_ _null_ ));
39813981
DESCR("get the open cursors for this session");
39823982
DATA(insert OID = 2599 ( pg_timezone_abbrevs PGNSP PGUID 12 1 1000 0 f f t t s 0 2249 "" "{25,1186,16}" "{o,o,o}" "{abbrev,utc_offset,is_dst}" pg_timezone_abbrevs _null_ _null_ _null_ ));
39833983
DESCR("get the available time zone abbreviations");

src/test/regress/expected/rules.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,15 +1279,15 @@ SELECT viewname, definition FROM pg_views WHERE schemaname <> 'information_schem
12791279
viewname | definition
12801280
--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
12811281
iexit | SELECT ih.name, ih.thepath, interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih, ramp r WHERE (ih.thepath ## r.thepath);
1282-
pg_cursors | SELECT c.name, c.statement, c.is_holdable, c.is_binary, c.is_scrollable, c.creation_time FROM pg_cursor() c(name text, statement text, is_holdable boolean, is_binary boolean, is_scrollable boolean, creation_time timestamp with time zone);
1282+
pg_cursors | SELECT c.name, c.statement, c.is_holdable, c.is_binary, c.is_scrollable, c.creation_time FROM pg_cursor() c(name, statement, is_holdable, is_binary, is_scrollable, creation_time);
12831283
pg_group | SELECT pg_authid.rolname AS groname, pg_authid.oid AS grosysid, ARRAY(SELECT pg_auth_members.member FROM pg_auth_members WHERE (pg_auth_members.roleid = pg_authid.oid)) AS grolist FROM pg_authid WHERE (NOT pg_authid.rolcanlogin);
12841284
pg_indexes | SELECT n.nspname AS schemaname, c.relname AS tablename, i.relname AS indexname, t.spcname AS tablespace, pg_get_indexdef(i.oid) AS indexdef FROM ((((pg_index x JOIN pg_class c ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_tablespace t ON ((t.oid = i.reltablespace))) WHERE ((c.relkind = 'r'::"char") AND (i.relkind = 'i'::"char"));
1285-
pg_locks | SELECT l.locktype, l.database, l.relation, l.page, l.tuple, l.virtualxid, l.transactionid, l.classid, l.objid, l.objsubid, l.virtualtransaction, l.pid, l.mode, l.granted FROM pg_lock_status() l(locktype text, database oid, relation oid, page integer, tuple smallint, virtualxid text, transactionid xid, classid oid, objid oid, objsubid smallint, virtualtransaction text, pid integer, mode text, granted boolean);
1286-
pg_prepared_statements | SELECT p.name, p.statement, p.prepare_time, p.parameter_types, p.from_sql FROM pg_prepared_statement() p(name text, statement text, prepare_time timestamp with time zone, parameter_types regtype[], from_sql boolean);
1287-
pg_prepared_xacts | SELECT p.transaction, p.gid, p.prepared, u.rolname AS owner, d.datname AS database FROM ((pg_prepared_xact() p(transaction xid, gid text, prepared timestamp with time zone, ownerid oid, dbid oid) LEFT JOIN pg_authid u ON ((p.ownerid = u.oid))) LEFT JOIN pg_database d ON ((p.dbid = d.oid)));
1285+
pg_locks | SELECT l.locktype, l.database, l.relation, l.page, l.tuple, l.virtualxid, l.transactionid, l.classid, l.objid, l.objsubid, l.virtualtransaction, l.pid, l.mode, l.granted FROM pg_lock_status() l(locktype, database, relation, page, tuple, virtualxid, transactionid, classid, objid, objsubid, virtualtransaction, pid, mode, granted);
1286+
pg_prepared_statements | SELECT p.name, p.statement, p.prepare_time, p.parameter_types, p.from_sql FROM pg_prepared_statement() p(name, statement, prepare_time, parameter_types, from_sql);
1287+
pg_prepared_xacts | SELECT p.transaction, p.gid, p.prepared, u.rolname AS owner, d.datname AS database FROM ((pg_prepared_xact() p(transaction, gid, prepared, ownerid, dbid) LEFT JOIN pg_authid u ON ((p.ownerid = u.oid))) LEFT JOIN pg_database d ON ((p.dbid = d.oid)));
12881288
pg_roles | SELECT pg_authid.rolname, pg_authid.rolsuper, pg_authid.rolinherit, pg_authid.rolcreaterole, pg_authid.rolcreatedb, pg_authid.rolcatupdate, pg_authid.rolcanlogin, pg_authid.rolconnlimit, '********'::text AS rolpassword, pg_authid.rolvaliduntil, pg_authid.rolconfig, pg_authid.oid FROM pg_authid;
12891289
pg_rules | SELECT n.nspname AS schemaname, c.relname AS tablename, r.rulename, pg_get_ruledef(r.oid) AS definition FROM ((pg_rewrite r JOIN pg_class c ON ((c.oid = r.ev_class))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (r.rulename <> '_RETURN'::name);
1290-
pg_settings | SELECT a.name, a.setting, a.unit, a.category, a.short_desc, a.extra_desc, a.context, a.vartype, a.source, a.min_val, a.max_val, a.enumvals FROM pg_show_all_settings() a(name text, setting text, unit text, category text, short_desc text, extra_desc text, context text, vartype text, source text, min_val text, max_val text, enumvals text);
1290+
pg_settings | SELECT a.name, a.setting, a.unit, a.category, a.short_desc, a.extra_desc, a.context, a.vartype, a.source, a.min_val, a.max_val, a.enumvals FROM pg_show_all_settings() a(name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals);
12911291
pg_shadow | SELECT pg_authid.rolname AS usename, pg_authid.oid AS usesysid, pg_authid.rolcreatedb AS usecreatedb, pg_authid.rolsuper AS usesuper, pg_authid.rolcatupdate AS usecatupd, pg_authid.rolpassword AS passwd, (pg_authid.rolvaliduntil)::abstime AS valuntil, pg_authid.rolconfig AS useconfig FROM pg_authid WHERE pg_authid.rolcanlogin;
12921292
pg_stat_activity | SELECT s.datid, d.datname, s.procpid, s.usesysid, u.rolname AS usename, s.current_query, s.waiting, s.xact_start, s.query_start, s.backend_start, s.client_addr, s.client_port FROM pg_database d, pg_stat_get_activity(NULL::integer) s(datid, procpid, usesysid, current_query, waiting, xact_start, query_start, backend_start, client_addr, client_port), pg_authid u WHERE ((s.datid = d.oid) AND (s.usesysid = u.oid));
12931293
pg_stat_all_indexes | SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, pg_stat_get_numscans(i.oid) AS idx_scan, pg_stat_get_tuples_returned(i.oid) AS idx_tup_read, pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch FROM (((pg_class c JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char"]));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy