X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id BD5D29FA50D for ; Tue, 27 Jun 2006 11:02:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 38667-07 for ; Tue, 27 Jun 2006 11:02:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.zanthus.com.br (mail.zanthus.com.br [200.212.65.85]) by postgresql.org (Postfix) with ESMTP id 22B9E9FA10A for ; Tue, 27 Jun 2006 11:02:01 -0300 (ADT) Received: from cprsakai ([192.168.0.71]) by mail.zanthus.com.br (8.13.4/8.13.4/Debian-3) with ESMTP id k5RE5Znd022762 for ; Tue, 27 Jun 2006 11:05:37 -0300 Reply-To: From: "Rodrigo Sakai" To: Subject: Joins between int and int[] Date: Tue, 27 Jun 2006 11:02:06 -0300 Message-ID: <000a01c699f2$4796d340$4700a8c0@TREEZANTHUS> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000B_01C699D9.224C0C40" X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Thread-Index: AcaZ8kYNTZBLUlYDQ4GHv7Ge9I0m4w== X-Zanthus-MailScanner: Found to be clean X-Zanthus-MailScanner-From: rodrigo.sakai@zanthus.com.br X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/285 X-Sequence-Number: 25521 This is a multi-part message in MIME format. ------=_NextPart_000_000B_01C699D9.224C0C40 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I want to use the system catalog tables/views to query some things, and one of the queries I have to do is joining pg_attribute and pg_constraint to know what constraint belongs to which table.attribute. My question is how can I write the join clause between a int (pg_attribute.attnum) and int[ ] (pg_constraint.conkey). The query is: select relname, attname, attnotnull, atthasdef from pg_class as pc inner join pg_attribute as pa on pc.oid=pa.attrelid inner join pg_constraint pcons on pc.oid=pcons.conrelid and pa.attnum = pcons.conkey -------> the problem Thanks!!! ------=_NextPart_000_000B_01C699D9.224C0C40 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

  Hi,

 

  I want to use the system catalog = tables/views to query some things, and one of the queries I have to do is joining pg_attribute and pg_constraint to know what constraint belongs to which table.attribute. My question is how can I write the join clause between = a int (pg_attribute.attnum) and int[ ] (pg_constraint.conkey).

 

 

The query is:

 

select relname, attname, attnotnull, = atthasdef

  from pg_class as pc =

  inner join pg_attribute as = pa

    on = pc.oid=3Dpa.attrelid

  inner join pg_constraint = pcons

     on = pc.oid=3Dpcons.conrelid

    and pa.attnum =3D = pcons.conkey          &= nbsp;       -----à the problem

 

 

 Thanks!!! 

 

------=_NextPart_000_000B_01C699D9.224C0C40--