Re: Using the internal data dictionary - Mailing list pgsql-general

From David Johnston
Subject Re: Using the internal data dictionary
Date
Msg-id D06BD242-FB1E-49C9-8DD0-AF5FCC1A0951@yahoo.com
Whole thread Raw
In response to Using the internal data dictionary  (Bill Thoen <bthoen@gisnet.com>)
Responses Re: Using the internal data dictionary  (Bill Thoen <bthoen@gisnet.com>)
List pgsql-general
On Nov 17, 2011, at 22:17, Bill Thoen <bthoen@gisnet.com> wrote:

> I need to assemble a complete data dictionary for project documentation and other purposes and I was wondering about
thepros and cons of using the pg_catalog metadata. But I hesitate to poke around in here because I don't know why it's
keptso out of sight and not much documented. But it seems like an ideal source of information to tap with a program to
generateaccurate, current reports of what's in the database. 
>
> Is this a bad idea (everything I'm thinking of doing would be read only except for the description fields) but I'd
justlike to make sure that there's not some innocent looking table in there that acts as a doomsday device if you so
muchas read its first record, etc.  I'm just not sure why this isn't more widely used or talked about. 
>
> Regards,
>
> Bill Thoen
> GISnet
> http://gisnet.com
> 303-786-9961
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


information_schema is the more standardized point of entry into the database meta-data, catalog is generally intended
forinternals use and thus has a less stable API contract.  That said, you are reinventing the wheel if you are looking
fora straight dump of the current reality.  Various third-party tools already do this.  I've used, but am not
affiliatedwith, PostgreSQL Maestro.  Also, pgAdmin, I think, provides access to this information as well (as does psql
viait's various commands). 

You should never directly update the catalog but instead use the appropriate SQL command.  For descriptions you need to
use"COMMENT ON".  Reading it should never cause a problem. 

David J.


pgsql-general by date:

Previous
From: Bill Thoen
Date:
Subject: Using the internal data dictionary
Next
From: John R Pierce
Date:
Subject: Re: Using the internal data dictionary