Re: Verhindern, dass im Mehrbenutzerbetrieb mit veralteten Daten gearbteitet wird

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Verhindern, dass im Mehrbenutzerbetrieb mit veralteten Daten gearbteitet wird
Date: 2004-05-07 00:33:04
Message-ID: 20040507023304.F677@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bastian

you are misunderstanding the difference between the "row
number" (there is no such thing inherent in relational
databases) and the primary key (or any other explicitely
numbering column).

The "row number" would be moving when deleting some records --
if it existed. It doesn't exist, however, and can only be
generated on the fly sequentially numbering the rows appearing
as query results. Thusly the order of rows is arbitrary and
not related to the "row number".

OTOH, the primary key, of course, doesn't change when you
delete a row. Neither does a "counting" column. Any column can
be *made* to change upon deletion by using triggers but at least
for primary keys that would be a very unclean thing to do
usually.

I think you need to think more carefully about your
application design and not select records for deletion based
on their line number in some frontend view but rather based
on their primary key that is kept with the data making up the
frontend display (it needn't be shown, though).

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-05-07 00:52:28 Re: 7.2 or 7.4 for critical data?
Previous Message Uwe C. Schroeder 2004-05-07 00:32:01 Re: Verhindern, dass im Mehrbenutzerbetrieb mit veralteten Daten gearbteitet wird