Re: The Information Schema vs the PG Catalog - Mailing list pgsql-sql

From George Pavlov
Subject Re: The Information Schema vs the PG Catalog
Date
Msg-id CCB89282FCE1024EA3DCE687A96A516403895D2B@ehost010-6.exch010.intermedia.net
Whole thread Raw
In response to The Information Schema vs the PG Catalog  ("Ken Winter" <ken@sunward.org>)
Responses Re: The Information Schema vs the PG Catalog  ("Ken Winter" <ken@sunward.org>)
List pgsql-sql
I would say that pg_catalog is the more complete one whereas the
information_schema the more generic, standards-conformant place. I would
stick with the information_schema unless that becomes inadequate. A case
in point may be sequences. Apart from
information_schema.columns.column_default I haven't seen them
represented anywhere there (please someone correct me if I am wrong).
You can get more information about sequences from pg_catalog.pg_class
(look for pg_class.relkind='S') and various views that sit on top of
that (e.g. pg_statio_all_sequences).

George


> I'm writing PL/pgSQL routines that generate triggers, functions,
> and rules based on design characteristics of tables, columns, and
> other database objects.  These routines need to be able to look up
> the definitions of these objects.  I see that there are two places
> available to look up this info: the Information Schema and in the
> PG Catalog.
>
> Which source is preferable?  Or if that answer isn't absolute,
> what are the reasons or conditions for preferring one over the
> other?
>
> Also, a specific question:  Does the Information Schema offer any
> way to list the sequences that exist and their attributes?  I
> can't seem to find any.
>


pgsql-sql by date:

Previous
From: Terry Lee Tucker
Date:
Subject: Re: Merry Xmas and a Happy New Year
Next
From: David Garamond
Date:
Subject: order and order line item