Scott Chapman <[EMAIL PROTECTED]> writes:
> It would be nice if PostgreSQL could return the primary key it inserted
> with but that may not be a fool-proof solution either. Is there a nice
> way to handle this situation?
Write a database function that inserts the record and returns the
primary
Scott Chapman <[EMAIL PROTECTED]> writes:
> On Wednesday 12 November 2003 11:29, Doug McNaught wrote:
> > Scott Chapman <[EMAIL PROTECTED]> writes:
> > > It would be nice if PostgreSQL could return the primary key it
> > > inserted with but that may not be a fool-proof solution either. Is
> > > t
"scott.marlowe" <[EMAIL PROTECTED]> writes:
> select tablename.fieldname.currval;
That syntax would be problematic, it would mean to select all rows from
tablename and evaluate fieldname.currval for each one. Actually it's worse, it
would be confused with schemas I think.
The postgres-ish way t
On Mon, Nov 10, 2003 at 08:56:03AM -0800, Scott Chapman wrote:
> I talked with the author or SQLObject about this recently and I thnk
> he's implementing this correctly, by querying the cursor for the last
> OID?:
That won't scale unless you index oid. And your tables will all need
oids, which
I saw this method of Statement class in jdbc.
Will the return int contain the autogenerated key value ??
public int executeUpdate(String sql,
int autoGeneratedKeys)
throws SQLException
thanks,
kathy
Scott Chapman wrote:
> On Monday 10 November 2003 08
On Monday 10 November 2003 08:23, David Green wrote:
> Are X & Y two different connections?
> If you execute 2 statements on the same connection and then get
> currval() it will give the last generated id.
>
> Ex.
> On 1 connection:
> INSERT INTO A (fld) VALUES (val); -- id generated = 1
> INSERT I
On Mon, Nov 10, 2003 at 08:09:29AM -0800, Scott Chapman wrote:
> Chronological events here:
>
> X inserts a new record into A.
> Y inserts a new record into A.
> X fetches currval of the SA. What value does X get in this case, the one
> from X's insert or Y's?
X's.
--
Alvaro Herrera ()
"¿Qué
On Sun, Nov 09, 2003 at 10:26:51AM -0800, Scott Chapman wrote:
> On Sunday 09 November 2003 03:13, Martijn van Oosterhout wrote:
> > After you've done the insert on the address table, you can use
> > currval('address_id_seq') (or equivalent) to get the ID. Ofcourse you
> > have to have used nextval
Scott Chapman <[EMAIL PROTECTED]> writes:
> On Sunday 09 November 2003 03:13, Martijn van Oosterhout wrote:
> > After you've done the insert on the address table, you can use
> > currval('address_id_seq') (or equivalent) to get the ID. Ofcourse you
> > have to have used nextval() for the original
On Sunday 09 November 2003 03:13, Martijn van Oosterhout wrote:
> After you've done the insert on the address table, you can use
> currval('address_id_seq') (or equivalent) to get the ID. Ofcourse you
> have to have used nextval() for the original insert.
What if someone else inserts another addre
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Martijn van Oosterhout wrote:
> After you've done the insert on the address table, you can use
> currval('address_id_seq') (or equivalent) to get the ID. Ofcourse you have
> to have used nextval() for the original insert.
>
> Hope this helps,
>
..goi
After you've done the insert on the address table, you can use
currval('address_id_seq') (or equivalent) to get the ID. Ofcourse you have
to have used nextval() for the original insert.
Hope this helps,
On Sun, Nov 09, 2003 at 11:29:49AM +0100, Andreas Fromm wrote:
> Hi,
>
> Im building an user
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
Im building an user database with many tables keeping the data for the
Address, Phone numbers, etc which are referenced by a table where I keep
the single users. My question is, how do I get the "Id"-value of a newly
inserted address to store it i
13 matches
Mail list logo