Re: Inspecting a DB - psql or system tables ? - Mailing list pgsql-general

From Greg Smith
Subject Re: Inspecting a DB - psql or system tables ?
Date
Msg-id 4DE1B360.4080801@2ndQuadrant.com
Whole thread Raw
In response to Inspecting a DB - psql or system tables ?  (Andre Majorel <aym-2lqsgp@teaser.fr>)
List pgsql-general
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 changing the format of the system tables, odds are the
text output from psql is going to be changed too.  psql gets tweaked to
display information better more often than the internals are altered.

Approaches you can take here, from most robust in the face of changes to
most fragile, in my mind are:

1) Use information_schema.  If all the info you need is in here, great;
it may not be though.
2) Use the system catalog data directly
3) Parse text output from psql.

--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books


pgsql-general by date:

Previous
From: Edison So
Date:
Subject: Re: max_connections proposal
Next
From: Greg Smith
Date:
Subject: Re: SELECT COUNT(*) execution time on large tables (v9.0.4-1)