system info functions

Started by Neil Conwayover 19 years ago4 messages
#1Neil Conway
neilc@samurai.com

(1) The docs claim that pg_get_viewdef() returns the "CREATE VIEW
command for view", but that is clearly not the case:

postgres=# create view v1 as select 1;
CREATE VIEW
postgres=# select pg_get_viewdef('v1'::regclass::oid);
pg_get_viewdef
----------------
SELECT 1;
(1 row)

Should we change the documentation, or the implementation of
pg_get_viewdef()?

(2) pg_get_indexdef() and pg_get_triggerdef() don't include a
terminating semi-colon, but pg_get_ruledef() does (as does the SELECT
statement returned by pg_get_viewdef()). Is there a good reason for this
inconsistency?

-Neil

#2Dave Page
dpage@vale-housing.co.uk
In reply to: Neil Conway (#1)
Re: system info functions

-----Original Message-----
From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Neil Conway
Sent: 04 July 2006 05:53
To: pgsql-hackers@postgresql.org
Subject: [HACKERS] system info functions

(1) The docs claim that pg_get_viewdef() returns the "CREATE VIEW
command for view", but that is clearly not the case:

postgres=# create view v1 as select 1;
CREATE VIEW
postgres=# select pg_get_viewdef('v1'::regclass::oid);
pg_get_viewdef
----------------
SELECT 1;
(1 row)

Should we change the documentation, or the implementation of
pg_get_viewdef()?

Documentation, unless we want to break apps that use the function.

Regards, Dave.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dave Page (#2)
Re: system info functions

"Dave Page" <dpage@vale-housing.co.uk> writes:

[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Neil Conway
Should we change the documentation, or the implementation of
pg_get_viewdef()?

Documentation, unless we want to break apps that use the function.

... such as pg_dump.

regards, tom lane

#4Jim Nasby
jnasby@pervasive.com
In reply to: Dave Page (#2)
Re: system info functions

On Jul 4, 2006, at 3:35 AM, Dave Page wrote:

-----Original Message-----
From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Neil Conway
Sent: 04 July 2006 05:53
To: pgsql-hackers@postgresql.org
Subject: [HACKERS] system info functions

(1) The docs claim that pg_get_viewdef() returns the "CREATE VIEW
command for view", but that is clearly not the case:

postgres=# create view v1 as select 1;
CREATE VIEW
postgres=# select pg_get_viewdef('v1'::regclass::oid);
pg_get_viewdef
----------------
SELECT 1;
(1 row)

Should we change the documentation, or the implementation of
pg_get_viewdef()?

Documentation, unless we want to break apps that use the function.

Though, it would be nice to get everything into a consistent state.
Since some get_*def commands have to return the create statements, we
should probably move everything in that direction (or have two sets
of functions, but that seems rather overblown...).
--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461