pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rodrigo Sakai <rodrigo.sakai@zanthus.com.br>
To: pgsql-sql@postgresql.org
Subject: Joins between int and int[]
Date: Tue, 27 Jun 2006 11:02:06 -0300
Message-ID: <000a01c699f2$4796d340$4700a8c0@TREEZANTHUS> (raw)

  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!!! 

 

Message-ID: <000a01c699f2$4796d340$4700a8c0@TREEZANTHUS>
Permalink:  ../000a01c699f2$4796d340$4700a8c0@TREEZANTHUS/
Also on:    postgresql.org/message-id/000a01c699f2$4796d340$4700a8c0@TREEZANTHUS

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rodrigo.sakai@zanthus.com.br
  Subject: Re: Joins between int and int[]
  In-Reply-To: <000a01c699f2$4796d340$4700a8c0@TREEZANTHUS>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox