[GENERAL] Inspecting a DB - psql or system tables ?

2011-05-27 Thread Andre Majorel
Suppose you want to write a program that connects to a PostgreSQL database and lists its tables and views, the type of their columns and their relationships (REFERENCES) for automatic joins. Would you look at the system tables (pg_class et al.) or the output of psql \d, \dt, etc ? While parsing t

Re: [GENERAL] Inspecting a DB - psql or system tables ?

2011-05-27 Thread fork
Andre Majorel teaser.fr> writes: > > Suppose you want to write a program that connects to a > PostgreSQL database and lists its tables and views, the type of > their columns and their relationships (REFERENCES) for automatic > joins. I personally would try to hit the "informat_schema", which is

Re: [GENERAL] Inspecting a DB - psql or system tables ?

2011-05-27 Thread Tomas Vondra
Dne 27.5.2011 19:24, Andre Majorel napsal(a): > Suppose you want to write a program that connects to a > PostgreSQL database and lists its tables and views, the type of > their columns and their relationships (REFERENCES) for automatic > joins. > > Would you look at the system tables (pg_class et

Re: [GENERAL] Inspecting a DB - psql or system tables ?

2011-05-27 Thread Andrew Sullivan
On Fri, May 27, 2011 at 08:26:33PM +0200, Tomas Vondra wrote: > > While parsing the output of psql is cumbersome, accessing the > > system tables seems more likely to break whenever a new version > > of PostgreSQL comes out. > > Really? Those catalogs are pretty stable, and when changed they're >

Re: [GENERAL] Inspecting a DB - psql or system tables ?

2011-05-28 Thread Greg Smith
On 05/27/2011 01:24 PM, Andre Majorel wrote: While parsing the output of psql is cumbersome, accessing the system tables seems more likely to break whenever a new version of PostgreSQL comes out. I think you have this backwards. If there's a change in this area big enough to justify chang

Re: [GENERAL] Inspecting a DB - psql or system tables ?

2011-05-30 Thread Nicholson, Brad (Toronto, ON, CA)
> -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Andrew Sullivan > Sent: Friday, May 27, 2011 2:32 PM > To: pgsql-general@postgresql.org > Subject: Re: [GENERAL] Inspecting a DB - psql or system ta