Re: About primary keys -- made some progress - Mailing list pgsql-sql

From Tom Lane
Subject Re: About primary keys -- made some progress
Date
Msg-id 24415.1061037371@sss.pgh.pa.us
Whole thread Raw
In response to Re: About primary keys -- made some progress  (Tim Andersen <timander37@yahoo.com>)
List pgsql-sql
Tim Andersen <timander37@yahoo.com> writes:
> I still have a question about how to get the
> information about length and precision of a column
> from pg_attributes.atttypmod.  are there built-in
> functions for PostgreSQL to extract this information?

Best is to rely on the format_type() function.  Also, have you thought
about using pg_get_indexdef() in place of all that hacking about in
pg_index?

http://www.postgresql.org/docs/7.3/static/functions-misc.html

In general, your code is less likely to break if you can use the
"catalog information functions" rather than poking around in the
catalogs directly.
        regards, tom lane


pgsql-sql by date:

Previous
From: Bengali
Date:
Subject: [Newbie] migrating a stored procedure from MSSQL to postgresql
Next
From: Ian Barwick
Date:
Subject: Re: Optional join