Re: [HACKERS] Information Schema and constraint names not unique

2003-11-07 Thread Bruce Momjian
Barry Lind wrote: > > > Tom Lane wrote: > > > >>Using tableoid instead of tablename avoids renaming problems, but makes > >>the names horribly opaque IMNSHO. > > > > > > Agreed. I think using the OIDs would be a horrible choice. > > > > As a point of reference Oracle uses a naming conventi

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-07 Thread Barry Lind
Tom Lane wrote: Using tableoid instead of tablename avoids renaming problems, but makes the names horribly opaque IMNSHO. Agreed. I think using the OIDs would be a horrible choice. As a point of reference Oracle uses a naming convention of 'C' where is a sequence generated unique

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-07 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan <[EMAIL PROTECTED]> writes: . add tableoid or tablename to information_schema.{check_constraints, referential_constraints} (I think those are the only places where it would be needed, from my quick skimming). . add tableoid or tablename to autogenerated table

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-07 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > I think there are several of them from this thread: > . make autogenerated column constraint names unique per table (by adding > "_$n" ?) Check. > . add tableoid or tablename to information_schema.{check_constraints, > referential_constraints} (I th

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-07 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> regression=# create table foo (f1 int check (f1 > 0) check (f1 < 10)); > >> ERROR: check constraint "foo_f1" already exists > > > Is this a TODO to fix? > > Probably should be. I'd be inclined to try to fix it

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-07 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> regression=# create table foo (f1 int check (f1 > 0) check (f1 < 10)); >> ERROR: check constraint "foo_f1" already exists > Is this a TODO to fix? Probably should be. I'd be inclined to try to fix it by generating "foo_f1_1", "foo_f

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-07 Thread Andrew Dunstan
Bruce Momjian wrote: Tom Lane wrote: Alvaro Herrera <[EMAIL PROTECTED]> writes: On Thu, Nov 06, 2003 at 11:42:13AM -0500, Tom Lane wrote: I don't have a problem with switching from "$1" to "tablename_$1", or some such, for auto-generated constraint names. But if it's not guaranteed

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-07 Thread Bruce Momjian
Tom Lane wrote: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > > On Thu, Nov 06, 2003 at 11:42:13AM -0500, Tom Lane wrote: > >> I don't have a problem with switching from "$1" to "tablename_$1", or > >> some such, for auto-generated constraint names. But if it's not > >> guaranteed unique, does it

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-06 Thread Andrew Dunstan
Tom Lane wrote: Peter Eisentraut <[EMAIL PROTECTED]> writes: I don't think we really need a method to guarantee unique names. It would already help a lot if we just added the table name, or something that was until a short time before the action believed to be the table name, or even only the

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-06 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > On Thu, Nov 06, 2003 at 11:42:13AM -0500, Tom Lane wrote: >> I don't have a problem with switching from "$1" to "tablename_$1", or >> some such, for auto-generated constraint names. But if it's not >> guaranteed unique, does it really satisfy Philip's c

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-06 Thread Alvaro Herrera
On Thu, Nov 06, 2003 at 11:42:13AM -0500, Tom Lane wrote: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > I don't think we really need a method to guarantee unique names. It would > > already help a lot if we just added the table name, or something that was > > until a short time before the act

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-06 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > I don't think we really need a method to guarantee unique names. It would > already help a lot if we just added the table name, or something that was > until a short time before the action believed to be the table name, or > even only the table OID, b

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-06 Thread Peter Eisentraut
Tom Lane writes: > > Would a good halfway house be to ensure that generated names were unique > > within a schema (e.g. instead of generating "$1" generate > > "tablename$1")? > > No, because that buys into all of the serialization and deadlocking > problems that doing it the spec's way entail I

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-06 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: >> The reason the spec defines these views this way is that it expects >> constraint names to be unique across a whole schema. We don't enforce >> that, and I don't think we want to start doing so (that was already >> proposed and shot down at least once)

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-06 Thread Andrew Dunstan
Tom Lane wrote: The reason the spec defines these views this way is that it expects constraint names to be unique across a whole schema. We don't enforce that, and I don't think we want to start doing so (that was already proposed and shot down at least once). You are of course free to use const

Re: [HACKERS] Information Schema and constraint names not unique

2003-11-06 Thread Tom Lane
Philip Warner <[EMAIL PROTECTED]> writes: > Notice that the two records are identical because the two constraint names > are the same. ISTM that we should have a way of usefully examining specific > constraints without having to name them. Can we add the constraint OID or No. The schemas of th