Thread: Re: [SQL] Uniqueness of rule, constraint, and trigger names

Re: [SQL] Uniqueness of rule, constraint, and trigger names

From
Tom Lane
Date:
"Dan Langille" <dan@langille.org> writes:
> On 4 Mar 2002 at 14:24, Tom Lane wrote:
>> ... but I'm a little worried about the possibility of errors
>> in loading schemas from existing databases, where there might be
>> non-unique constraint names.

> Create a tool to generate unique constraint names during a dump.

And then all we need is a time machine, so we can make existing
instances of pg_dump contain the tool?  It's not that easy ...

I am not sure that there's really a problem here, because I don't
think duplicate constraint names will be generated during plain
CREATE operations.  However, an ALTER TABLE might leave you with
a problem.  Hard to tell if this is critical enough to worry about.
        regards, tom lane


Re: [SQL] Uniqueness of rule, constraint, and trigger names

From
"Rod Taylor"
Date:
If pgupgrade can be fixed to work, perhaps it could set off warnings
on items that need to be corrected in a 'schema upgradability test'
which will ensure that the user can upgrade it properly -- it
shouldn't upgrade if it can't guarentee an upgrade will succeed.

This should include full schema test (that whole bad schema entry
stuff that pg_dump is supposed to work around) too.

Something I'm thinking about digging into.

--
Rod Taylor

This message represents the official view of the voices in my head

----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: <dan@langille.org>
Cc: <pgsql-hackers@postgreSQL.org>; <pgsql-sql@postgreSQL.org>
Sent: Monday, March 04, 2002 3:38 PM
Subject: Re: [HACKERS] [SQL] Uniqueness of rule, constraint, and
trigger names


> "Dan Langille" <dan@langille.org> writes:
> > On 4 Mar 2002 at 14:24, Tom Lane wrote:
> >> ... but I'm a little worried about the possibility of errors
> >> in loading schemas from existing databases, where there might be
> >> non-unique constraint names.
>
> > Create a tool to generate unique constraint names during a dump.
>
> And then all we need is a time machine, so we can make existing
> instances of pg_dump contain the tool?  It's not that easy ...
>
> I am not sure that there's really a problem here, because I don't
> think duplicate constraint names will be generated during plain
> CREATE operations.  However, an ALTER TABLE might leave you with
> a problem.  Hard to tell if this is critical enough to worry about.
>
> regards, tom lane
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>



Re: [SQL] Uniqueness of rule, constraint, and trigger names

From
"Dan Langille"
Date:
On 4 Mar 2002 at 15:38, Tom Lane wrote:

> "Dan Langille" <dan@langille.org> writes:
> > On 4 Mar 2002 at 14:24, Tom Lane wrote:
> >> ... but I'm a little worried about the possibility of errors
> >> in loading schemas from existing databases, where there might be
> >> non-unique constraint names.
> 
> > Create a tool to generate unique constraint names during a dump.
> 
> And then all we need is a time machine, so we can make existing
> instances of pg_dump contain the tool?  It's not that easy ...

*sigh*

You don't have to modify all previous versions of pg_dump.  They use this 
tool if they want to upgrade to this version.  There is no perfect 
solution.  Even a script to check for uniqueness might help.  I'm just 
trying to help the best way I can; by providing suggestions.  As 
requested.

> I am not sure that there's really a problem here, because I don't
> think duplicate constraint names will be generated during plain
> CREATE operations.  However, an ALTER TABLE might leave you with
> a problem.  Hard to tell if this is critical enough to worry about.

It would be easily detected at load time.  Then you direct the user to the 
tool mentioned above.
-- 
Dan Langille
The FreeBSD Diary - http://freebsddiary.org/ - practical examples