Re: changing multiple pk's in one update

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Stuart McGraw <smcg2297(at)frii(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: changing multiple pk's in one update
Date: 2009-04-10 18:20:20
Message-ID: dcc563d10904101120y49f00977nc74132e982518444@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2009/4/7 Stuart McGraw <smcg2297(at)frii(dot)com>:
> Hello all,
>
> I have a table with a primary key column
> that contains sequential numbers.
>
> Sometimes I need to shift them all up or down
> by a fixed amount.  For example, if I have
> four rows with primary keys, 2, 3, 4, 5, I
> might want to shift them down by 1 by doing:
>

Generally speaking, when you need to do this more than once or twice
in the lifetime of your data, there's something wrong with your data
model.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jasen Betts 2009-04-10 22:41:54 Re: SQL to Check whether "AN HOUR PERIOD" is between start and end timestamps
Previous Message Jasen Betts 2009-04-10 15:09:42 Re: How would I get rid of trailing blank line?