Re: operator exclusion constraints

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: operator exclusion constraints
Date: 2009-11-25 23:59:43
Message-ID: 1259193583.1175.59.camel@monkey-cat.sm.truviso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2009-11-25 at 09:02 -0500, Robert Haas wrote:
> I disagree wholeheartedly. :-) My ideal error message is something like:
>
> DETAIL: (a, b, c)=(1, 2, 3) conflicts with (a, b, c)=(4, 5, 6)
>
> In particular, I think it's very important that we only emit the
> columns which are part of the operator exclusion constraints, and NOT
> all the columns of the tuple. The entire tuple could be very large -
> one of the columns not involved in the constraint could be a 4K block
> of text, for example, and spitting that out only obscures the real
> source of the problem. You could argue that one of the columns
> involved in the constraint could be a 4K block text, too, but in
> practice I think the constraint columns are likely to be short nine
> times out of ten. The equals sign is equating the column names to the
> column values, not the values to each other, so I don't see that as
> confusing.

Ok, fair enough. But how do you feel about:
(a: 1, b: 2, c: 3)
as a tuple representation instead? I think it's closer to the way people
expect a tuple to be represented. I can change it in one place so that
the unique violations are reported that way, as well (as long as there
are no objections).

It still doesn't contain the operators, but they can look at the
constraint definition for that.

> My operator-class-fu is insufficient to render judgment on this point.
> I think the thing to do is look at a bunch of non-built-in opclasses
> and check for POLA violations.

Ok, I'll consider this more.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2009-11-26 00:07:59 Re: Application name patch - v3
Previous Message Robert Haas 2009-11-25 23:28:29 Re: Partitioning option for COPY