Re: Guarenteeing ordering constraints - Mailing list pgsql-general

From Tom Lane
Subject Re: Guarenteeing ordering constraints
Date
Msg-id 5772.1172160974@sss.pgh.pa.us
Whole thread Raw
In response to Guarenteeing ordering constraints  ("Joris Dobbelsteen" <Joris@familiedobbelsteen.nl>)
List pgsql-general
"Joris Dobbelsteen" <Joris@familiedobbelsteen.nl> writes:
> I have some trouble guarenteeing that an ordering constraint is enforced
> on the database. On the table ordering (see below) I want to enforce
> that for every tuple t, all tuples u where u.position < t.position this
> implies u.cumvalue <= t.cumvalue.

I can't think of any reasonable way to enforce that in SQL.  Perhaps you
should consider restructuring your tables in such a way that this
behavior emerges from a constraint that is enforceable --- maybe the
cumulative values should be a (materialized?) view on an underlying
table that contains individual observations.

            regards, tom lane

pgsql-general by date:

Previous
From: Lincoln Yeoh
Date:
Subject: Re: postgresql vs mysql
Next
From: Tim Tassonis
Date:
Subject: Re: php professional