Re: [ADMIN] sequence value of the record just inserted.

2004-04-14 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Also, in perl DBI, the solutions all require executing at least > 2 sql statements. Nothing wrong with that. > I initially hoped there'd be a way to get the oid or sequence number > at the same time as executing an INSERT (one sql statement),

Re: [ADMIN] sequence value of the record just inserted / DBI

2004-04-14 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Perl's DBI has the following function. > > $rv = $dbh->last_insert_id($catalog, $schema, $table, $field); > "Returns a value 'identifying' the row just inserted, if possible." > > I wonder what this $catalog is in this context. It's supposed to b

Re: [ADMIN] sequence value of the record just inserted / DBI

2004-04-14 Thread Jeremy Buchmann
On Apr 14, 2004, at 10:53 AM, Ben Kim wrote: I hope it is OK to ask the question here. Perl's DBI has the following function. $rv = $dbh->last_insert_id($catalog, $schema, $table, $field); "Returns a value 'identifying' the row just inserted, if possible." I wonder what this $catalog is in this

[ADMIN] sequence value of the record just inserted / DBI

2004-04-14 Thread Ben Kim
I hope it is OK to ask the question here. Perl's DBI has the following function. $rv = $dbh->last_insert_id($catalog, $schema, $table, $field); "Returns a value 'identifying' the row just inserted, if possible." I wonder what this $catalog is in this context. It's supposed to be metadata, and

Re: [ADMIN] sequence value of the record just inserted.

2004-04-14 Thread Ben Kim
Thanks to those who offered help, The suggested solutions are, 1. Select nextval('myseq'), then use the nextval as the new id to insert a new record. 2. Insert a new record, then do select currval('myseq') or select last_val from myseq; supposed to be safe 3. use transaction to guarantee safety

Re: [ADMIN] sequence value of the record just inserted.

2004-04-09 Thread Jim Seymour
Ben Kim <[EMAIL PROTECTED]> wrote: > > > Dear admins, > > I have a table whose primary key is a record_id with serial type. > > I would like to know, when I insert a new row, what was the value of the > record_id that I just inserted. Since this is a multi user application, I > cannot simply s

Re: [ADMIN] sequence value of the record just inserted.

2004-04-09 Thread scott.marlowe
On Fri, 9 Apr 2004, Ben Kim wrote: > > Dear admins, > > I have a table whose primary key is a record_id with serial type. > > I would like to know, when I insert a new row, what was the value of the > record_id that I just inserted. Since this is a multi user application, I > cannot simply sel

[ADMIN] sequence value of the record just inserted.

2004-04-09 Thread Ben Kim
Dear admins, I have a table whose primary key is a record_id with serial type. I would like to know, when I insert a new row, what was the value of the record_id that I just inserted. Since this is a multi user application, I cannot simply select max of the record_id or currval of the sequence.