Re: Wrong OID for Primary Key and UNIQUE constraints shown in property pane - Mailing list pgadmin-support

From Dave Page
Subject Re: Wrong OID for Primary Key and UNIQUE constraints shown in property pane
Date
Msg-id 4613C9DB.4000000@postgresql.org
Whole thread Raw
In response to Wrong OID for Primary Key and UNIQUE constraints shown in property pane  ("Harald Armin Massa" <haraldarminmassa@gmail.com>)
Responses Re: Wrong OID for Primary Key and UNIQUE constraints shown in property pane
List pgadmin-support
Harald Armin Massa wrote:
> Hello,
> 
> I tried to get the definition of unique and primary key constraints via
> 
> select pg_get_constraintdef(<oidofconstraint>)
> 
> as oidofconstraint I put the OID displayed in pg_admins property pain
> when selecting a constraint.
> 
> This failed with
> 
> ERROR: could not find tuple for constraint 36099
> SQL state: XX000
> 
> when I took the OID from UNIQUE and PRIMARY KEY constraints.
> 
> Then I moved on and took the OID from FOREIGN KEY constraints, and got
> results...
> 
> 
> digging in pg_catalog.pg_constraints made me learn that pg_admin shows
> those OIDs for UNIQUE and PRIMARY key constraints "off by one", that is:
> 
> if  I do
> 
> select pg_get_constraintdef(36100)
> 
> instead of
> 
> select pg_get_constraintdef(36099)
> 
> I get the needed result....
> 
> Please find that "-1" and add it again :)

Thanks Harald - it was showing the OID of the index, not the constraint
record. I've fixed that, and modified the code to display the index OID
as a seperate property.

Regards, Dave


pgadmin-support by date:

Previous
From: "Harald Armin Massa"
Date:
Subject: Wrong OID for Primary Key and UNIQUE constraints shown in property pane
Next
From: Dave Page
Date:
Subject: pgAdmin packages for Solaris available