Joins between int and int[] - Mailing list pgsql-sql

From Rodrigo Sakai
Subject Joins between int and int[]
Date
Msg-id 000a01c699f2$4796d340$4700a8c0@TREEZANTHUS
Whole thread Raw
List pgsql-sql

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

 

pgsql-sql by date:

Previous
From: Joe
Date:
Subject: Re: Fwd: Start up question about triggers
Next
From: Kyle Bateman
Date:
Subject: Schema management tool