Re: enhanced error fields

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Peter Geoghegan <peter(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: enhanced error fields
Date: 2012-12-30 06:34:00
Message-ID: CAFj8pRBns-ZvZ2T+03BV5KoNxONSdcU7E7FmmFktJzcyCJ4H1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/12/30 Stephen Frost <sfrost(at)snowman(dot)net>:
> * Peter Geoghegan (peter(at)2ndquadrant(dot)com) wrote:
>> On 30 December 2012 03:32, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>> > Err. I intended to say "I really don't think what I sketched out, or
>> > something similar, would be that unlikely to happen", or something along
>> > those lines. Apologies for the confusion.
>>
>> Almost anything can be misused.
>
> I agree, almost anything can be. The 'misuse' in this case, however, is
> in expecting the information returned to be useful in a deterministic
> and consistent manner, as it's being returned in a programmatic fashion.
>
>> If you're going to insist that I hack a bunch of mechanism into this
>> patch so that the user can unambiguously identify each constraint
>> object, I'll do that.
>
> This is the part that I'm having trouble wrapping my head around- what's
> the additional complexity here? If we have the OID of the constraint,
> we should be able to unambiguoulsy return information which allows a
> user to get back to that specific constraint and OID.
>
>> However, that's more code, and more complexity,
>> that will have to be documented, for just next to no practical benefit
>> that I can see.
>
> I've certainly seen cases where constraints are duplicated by name
> across schemas. I would imagine it could happen across tables in the
> same schema also. I just don't like this notion of returning something
> ambiguous to the user and worry that they'd accept it as deterministic
> and dependable, regardless of the documentation. There's a certain
> amount of "read the docs, but also look at what information you really
> get back", which I think is, in general, a good thing, but it does mean
> individuals might come to believe that they can depend on the constraint
> name being unique in all cases.
>
> As a side-note, I've recently run into more cases than I care to think
> about where the 63-character limit on constraint names has been a
> problem- because we're trying to ensure that we create an unambiguous
> constraint name, and that's *with* various name shortening techniques
> being used. The discussion about having longer values possible for the
> 'name' data type was on a different thread and should probably stay
> there, but I bring it up because it has some impact on the possibility
> of name collisions which is relevent to this discussion.

so - cannot be a solution define CONSTRAINT_TABLE field - constaint
names in table are unique.

sure there is a problem with long names, but I am thinking so it has
solution - when constraint has no name, then we can try to generate
name, and when this name is longer than 63 chars, then CREATE
STATEMENT fails and users should be define name manually - this
feature should be disabled by guc due compatibility issues.

Regards

Pavel
>
> Thanks,
>
> Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-12-30 12:18:32 Re: Event Triggers: adding information
Previous Message Daniel Farina 2012-12-30 06:31:47 Re: pg_stat_statements: calls under-estimation propagation