X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 867C430DD80 for ; Tue, 10 Jun 2003 17:46:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 14847-10 for ; Tue, 10 Jun 2003 14:45:51 -0300 (ADT) Received: from luna.lyris.com (luna.lyris.com [216.91.57.116]) by svr1.postgresql.org (Postfix) with ESMTP id 9ABF930E5E1 for ; Tue, 10 Jun 2003 14:45:50 -0300 (ADT) Received: from luna.lyris.com (luna.lyris.com [216.91.57.116]) by luna.lyris.com (8.12.8/8.12.8) with SMTP id h5AHjiWW005686; Tue, 10 Jun 2003 10:45:44 -0700 Received: from forest (forest.lyris.com [216.91.56.45]) by luna.lyris.net with SMTP (MailShield v2.04 - LINUX Jul 17 2001 16:58:31); Tue, 10 Jun 2003 10:45:44 -0700 From: Forest Wilkinson To: Rod Taylor Cc: pgsql-sql@postgresql.org Subject: Re: how to determine array size Date: Tue, 10 Jun 2003 10:45:36 -0700 Message-ID: <7c5cev0486tkbu5rdne84cki9fvim3l60n@4ax.com> References: <1055246667.56597.39.camel@jester> In-Reply-To: <1055246667.56597.39.camel@jester> X-Mailer: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-SMTP-HELO: forest X-SMTP-MAIL-FROM: lyris-pg@tibit.com X-SMTP-RCPT-TO: rbt@rbt.ca,pgsql-sql@postgresql.org X-SMTP-PEER-INFO: forest.lyris.com [216.91.56.45] X-Archive-Number: 200306/86 X-Sequence-Number: 13844 >> I need to enumerate the constraints on any given column in a table, so >> I'm examining pg_constraint to get the relevant information. The >> conkey array contains a list of constrained columns, and although I am >> able to check conkey[1] for constraints on a single column, I would >> like to properly handle multi-column constraints. > >You may have an easier time dealing with pg_get_constraintdef() than >trying to get the info from the source. Is pg_get_constraintdef() documented somewhere? I'd like to know it's arguments, return format, and whether it will be supported in future postgres releases. =46rom what I see in pg_dump.c, it appears to accept an oid from the pg_constraint table, and only work with foreign key constraints. True? That might be useful in some special-case code, but I really want a method that will work with all types of constraint. (The idea here is to enumerate all constraints on a table, along with their names, types, and constrained columns.)