Re: Re: postgres TODO

From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: Alessio Bragadini <alessio(at)albourne(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: postgres TODO
Date: 2000-07-10 13:52:21
Message-ID: m13Bdyw-000AXuC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thus spake Alessio Bragadini
> > > * Add function to return primary key value on INSERT
> >
> > I don't get the point of this. Don't you know what you inserted? For
> > sequences there's curval()
>
> Mmmhhh... it means that we can assume no update to the sequence value
> between the insert and the curval selection?

We can within one connection so this is safe but there are other problems
which I am not sure would be solved by this anyway. With rules, triggers
and defaults there are often changes to the row between the insert and the
values that hit the backing store. This is a general problem of which
the primary key is only one example.

In fact, the OID of the new row is returned so what stops one from just
using it to get any information required. This is exactly what PyGreSQL
does in its insert method. After returning, the dictionary used to store
the fields for the row have been updated with the actual contents of the
row in the database. It simply does a "SELECT *" using the new OID to
get the row back.

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas SB 2000-07-10 13:58:08 AW: Re: postgres TODO
Previous Message Zeugswetter Andreas SB 2000-07-10 13:49:31 AW: AW: more corruption