Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-24 Thread Fabrízio de Royes Mello
On Tue, Mar 24, 2015 at 4:28 PM, Fabrízio de Royes Mello < fabriziome...@gmail.com> wrote: > > > > On Mon, Mar 23, 2015 at 12:33 PM, Tom Lane wrote: > > > > =?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > > > On Fri, Mar 20, 2015 at 4:37 PM, Tom Lane wrote: > > We could fix it by, say, h

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-24 Thread Fabrízio de Royes Mello
On Mon, Mar 23, 2015 at 12:33 PM, Tom Lane wrote: > > =?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > > On Fri, Mar 20, 2015 at 4:37 PM, Tom Lane wrote: > We could fix it by, say, having CheckConstraintFetch() sort the > constraints by name after loading them. > > > Isn't better do

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-24 Thread David Rowley
On 24 March 2015 at 17:51, Ashutosh Bapat wrote: > > In case of million inserts or bulk load with constraints on, these few > cycles spent in ordering the constraints might be problematic, unless the > ordering happens only once for a series of inserts. > As far as I can see this sort only occu

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-23 Thread Ashutosh Bapat
On Mon, Mar 23, 2015 at 7:46 PM, Tom Lane wrote: > Ashutosh Bapat writes: > > I might be only one objecting here but ... > > On Sat, Mar 21, 2015 at 12:45 AM, Tom Lane wrote: > >> My Salesforce colleagues noticed some tests flapping as a result of > table > >> CHECK constraints not always being

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-23 Thread Tom Lane
=?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > On Fri, Mar 20, 2015 at 4:37 PM, Tom Lane wrote: We could fix it by, say, having CheckConstraintFetch() sort the constraints by name after loading them. > Isn't better do this to read pg_constraint in name order? > - conscan = systa

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-23 Thread Fabrízio de Royes Mello
On Fri, Mar 20, 2015 at 4:37 PM, Tom Lane wrote: > > =?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > > On Fri, Mar 20, 2015 at 4:19 PM, Peter Geoghegan wrote: > >> On Fri, Mar 20, 2015 at 12:15 PM, Tom Lane wrote: > >>> We could fix it by, say, having CheckConstraintFetch() sort the > >>> co

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-23 Thread Tom Lane
Ashutosh Bapat writes: > I might be only one objecting here but ... > On Sat, Mar 21, 2015 at 12:45 AM, Tom Lane wrote: >> My Salesforce colleagues noticed some tests flapping as a result of table >> CHECK constraints not always being enforced in the same order; ie, if a >> tuple insertion/update

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-22 Thread Ashutosh Bapat
I might be only one objecting here but ... On Sat, Mar 21, 2015 at 12:45 AM, Tom Lane wrote: > My Salesforce colleagues noticed some tests flapping as a result of table > CHECK constraints not always being enforced in the same order; ie, if a > tuple insertion/update violates more than one CHECK

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-22 Thread David G. Johnston
On Sunday, March 22, 2015, David Steele wrote: > On 3/20/15 3:37 PM, Tom Lane wrote: > > =?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= > writes: > >> On Fri, Mar 20, 2015 at 4:19 PM, Peter Geoghegan > wrote: > >>> On Fri, Mar 20, 2015 at 12:15 PM, Tom Lane > wrote: > We could fix it by, say, h

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-22 Thread David Steele
On 3/20/15 3:37 PM, Tom Lane wrote: > =?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: >> On Fri, Mar 20, 2015 at 4:19 PM, Peter Geoghegan wrote: >>> On Fri, Mar 20, 2015 at 12:15 PM, Tom Lane wrote: We could fix it by, say, having CheckConstraintFetch() sort the constraints by name af

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-20 Thread Gavin Flower
On 21/03/15 08:15, Tom Lane wrote: My Salesforce colleagues noticed some tests flapping as a result of table CHECK constraints not always being enforced in the same order; ie, if a tuple insertion/update violates more than one CHECK constraint, it's not deterministic which one is reported. This

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-20 Thread Tom Lane
=?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > On Fri, Mar 20, 2015 at 4:19 PM, Peter Geoghegan wrote: >> On Fri, Mar 20, 2015 at 12:15 PM, Tom Lane wrote: >>> We could fix it by, say, having CheckConstraintFetch() sort the >>> constraints by name after loading them. >> What not by OID, as

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-20 Thread Fabrízio de Royes Mello
On Fri, Mar 20, 2015 at 4:19 PM, Peter Geoghegan wrote: > > On Fri, Mar 20, 2015 at 12:15 PM, Tom Lane wrote: > > We could fix it by, say, having CheckConstraintFetch() sort the > > constraints by name after loading them. > > > What not by OID, as with indexes? Are you suggesting that this would

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-20 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: > My Salesforce colleagues noticed some tests flapping as a result of table > CHECK constraints not always being enforced in the same order; ie, if a > tuple insertion/update violates more than one CHECK constraint, it's not > deterministic which one is report

Re: [HACKERS] Order of enforcement of CHECK constraints?

2015-03-20 Thread Peter Geoghegan
On Fri, Mar 20, 2015 at 12:15 PM, Tom Lane wrote: > We could fix it by, say, having CheckConstraintFetch() sort the > constraints by name after loading them. What not by OID, as with indexes? Are you suggesting that this would become documented behavior? -- Peter Geoghegan -- Sent via pgsql

[HACKERS] Order of enforcement of CHECK constraints?

2015-03-20 Thread Tom Lane
My Salesforce colleagues noticed some tests flapping as a result of table CHECK constraints not always being enforced in the same order; ie, if a tuple insertion/update violates more than one CHECK constraint, it's not deterministic which one is reported. This is evidently because relcache.c's Che