Alvaro Herrera wrote:
> Alban Hertroys wrote:
> > Richard Huxton wrote:
> > > Alban Hertroys wrote:
> > >> Naz Gassiep wrote:
> > >>> Hi,
> > >>> I'm trying to do an update on a table that has a unique constraint
> > >>> on the field, I need to update the table by setting field = field+1
> > >
Alban Hertroys wrote:
> Richard Huxton wrote:
> > Alban Hertroys wrote:
> >> Naz Gassiep wrote:
> >>> Hi,
> >>> I'm trying to do an update on a table that has a unique constraint
> >>> on the field, I need to update the table by setting field = field+1
> >
> >> I think you're looking for defe
Richard Huxton wrote:
> Alban Hertroys wrote:
>> Naz Gassiep wrote:
>>> Hi,
>>> I'm trying to do an update on a table that has a unique constraint
>>> on the field, I need to update the table by setting field = field+1
>
>> I think you're looking for deferrable constraints; see:
>>
>> http://
> If you are updating a large portion of your tree, you will probably want to
> throw in a vacuum in
> between the two updates. This should reduce the bloat caused by dead tuples
> in both your index
> and table.
... but that will only work if you can commit the first set of changes
before you
> > update foo
> > set field = -1 * (field + 1);
> > update foo
> > set field = -1 * field
> > where field < 0;
> >
> Yes, in fact I actually use option one already in the handling of sql
> trees, so I'm annoyed with myself for not figuring that out. I don't
> know why you'd ever use your second op
On May 2, 2007, at 23:36 , Naz Gassiep wrote:
I don't
know why you'd ever use your second option ever, as it virtually
guarantees problems at a random point in your DB's growth.
There may be cases where the values are not all positive so you can't
use the -1 * technique, but the offset will
Alban Hertroys wrote:
Naz Gassiep wrote:
Hi,
I'm trying to do an update on a table that has a unique constraint
on the field, I need to update the table by setting field = field+1
I think you're looking for deferrable constraints; see:
http://www.postgresql.org/docs/8.2/static/sql-set-c
Naz Gassiep wrote:
> Hi,
> I'm trying to do an update on a table that has a unique constraint
> on the field, I need to update the table by setting field = field+1
> however if this does not perform the updates on the table in a proper
> order (from last to first) then the update will cause a
Michael Glaesemann wrote:
>
> On May 2, 2007, at 23:01 , Naz Gassiep wrote:
>
>> I'm trying to do an update on a table that has a unique constraint
>> on the field, I need to update the table by setting field = field+1
>> however if this does not perform the updates on the table in a proper
>>
On May 2, 2007, at 23:01 , Naz Gassiep wrote:
I'm trying to do an update on a table that has a unique constraint
on the field, I need to update the table by setting field = field+1
however if this does not perform the updates on the table in a proper
order (from last to first) then the upda
10 matches
Mail list logo