X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 720D2D1B8B7 for ; Sat, 16 Aug 2003 12:36:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 61027-06 for ; Sat, 16 Aug 2003 09:36:14 -0300 (ADT) Received: from sss.pgh.pa.us (sss-backup.pgh.pa.us [216.151.103.158]) by svr1.postgresql.org (Postfix) with ESMTP id DB7D0D1B8B4 for ; Sat, 16 Aug 2003 09:36:09 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h7GCaC5H024416; Sat, 16 Aug 2003 08:36:12 -0400 (EDT) To: Tim Andersen Cc: pgsql-sql@postgresql.org Subject: Re: About primary keys -- made some progress In-reply-to: <20030816041559.74395.qmail@web10006.mail.yahoo.com> References: <20030816041559.74395.qmail@web10006.mail.yahoo.com> Comments: In-reply-to Tim Andersen message dated "Fri, 15 Aug 2003 21:15:59 -0700" Date: Sat, 16 Aug 2003 08:36:11 -0400 Message-ID: <24415.1061037371@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/200 X-Sequence-Number: 14816 Tim Andersen 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