Re: 32 Character Constraint Name Bug?

From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: <efesar(at)nmia(dot)com>, <pgadmin-support(at)postgresql(dot)org>
Subject: Re: 32 Character Constraint Name Bug?
Date: 2002-12-02 09:10:52
Message-ID: 03AF4E498C591348A42FC93DEA9661B8128CCA@mail.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

> -----Original Message-----
> From: the kay (efesar) [mailto:efesar(at)nmia(dot)com]
> Sent: 01 December 2002 05:53
> To: pgadmin-support(at)postgresql(dot)org
> Subject: [pgadmin-support] 32 Character Constraint Name Bug?
>
>
>
> First of all, sorry for the long post. I think I found a bug.
>
> I get this error when I click on my table "fearuser" in the tree
> schemas->public->tables (table definition to follow).
>
> ==========
>
> pgAdmin II Error
>
> An error has occurred in pgAdmin II:frmMain.tvTable:
>
> Number: 457
> Description: This key is already associated with an element
> of this collection
>
> OK
>
> ==========
>
> After clicking OK, the fearuser table is displayed, but only
> Checks (0) and Columns (30) are displayed. I think there is
> an error displaying the foreign keys. I have two foreign
> keys, one with the name "fearusersecuritylevel_fearuser"
> (which is 32 characters long) and
> "fearusersecuritylevel_fearusers" (which is 33 characters
> long). I think there is a bug in either PG or PGAdmin. I
> understand the name limit in PG is 32 characters, but it
> seems to have created a 33 character long object name. I
> think PGAdmin is truncating it to 32 characters, and it can't
> add two of the same names to the foreign key list.

I just tried this on 7.2.0 and it works fine. Can you supply a full
debug logfile of the error occuring, and perhaps a schema-only pg_dump
of your database?

> This was a mistake when I created the foreign keys. I
> accidentally misnamed one of the foreign keys. I would like
> to rename it, but as far as I know I can't rename
> constraints. Also, I can't drop the constraint because
> (according to the documentation) "To remove FOREIGN KEY
> constraints you need to recreate and reload the table".
> Reloading the table is not possible (or would be extremely
> hard) because at least 50 views and 20 tables depend on this table.

You should be able to rename them by manually updating the relevant
entries in pg_trigger. Try it on a test system first though - I've never
done it myself and there might be some reason why it doesn't work
correctly.

> Speaking of which ... does PGAdmin do dependency checking? If
> not, I might be able to lend a hand in writing some code to
> check dependencies (like the MSSQL Enterprise Manager) ...
> that might be a useful feature I've always imagined ... I was
> also looking at the part about adding foreign keys to tables
> ... is that hard to code or has it just been on nobody's
> priority list? I might be able to help there too ... (this is
> off topic -- i should subscribe to the hacker list) ...

Jean-Michel Poure added dependency tracking to pgAdmin I, but I was
never 100% happy with it. PostgreSQL is in a far better position to do
it, and in fact does now in 7.3.

Regards, Dave.

Browse pgadmin-support by date

  From Date Subject
Next Message Jochem van Dieten 2002-12-02 09:55:32 Re: altering the name of the public schema [SOLVED]
Previous Message Dave Page 2002-12-02 08:26:46 Re: kinda weird