RE:

From: "Rainer Mager" <rmager(at)vgkk(dot)co(dot)jp>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: RE:
Date: 2000-04-19 11:41:58
Message-ID: NEBBJBCAFMMNIHGDLFKGGENFCAAA.rmager@vgkk.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


Does anyone know of a good way to do something similar in Java (JDBC)
connected to Postgres?

Thanks,

--Rainer

> -----Original Message-----
> From: pgsql-admin-owner(at)hub(dot)org
> [mailto:pgsql-admin-owner(at)hub(dot)org]On Behalf Of Vladimir V. Zolotych
> Sent: Wednesday, April 19, 2000 6:34 PM
> To: Andrew Perrin - Demography
> Cc: pgsql-admin(at)postgresql(dot)org
> Subject: [ADMIN]
>
>
> > ......... In my case, I used currval(). Basically:
> >
> > SELECT currval('table_field_seq');
> >
> > will return the most recently assigned value to the field *by the
> > current
> > backend* which means:
> >
> > - There's no danger of a race condition (another user creating a
> > record in
> > the time between your creating the record and calling currval); BUT
> > - You must be using the same backend as you did on the creation.
>
> This is the way I've used before. It seems the the better way
> (thanks to Charles Martin <martin(at)chasm(dot)org>) is:
>
> 1) Do INSERT
> PGresult* res = PQexec(conn, "INSERT......")
>
> 2) Get the OID of the just inserted record e.g
> const char* oid = PQoidStatus(res)
>
> 3) Select the id of this record:
> res = PQexec(conn, "SELECT id .... WHERE OID=....");
>
>
>

In response to

  • at 2000-04-19 09:34:15 from Vladimir V. Zolotych

Browse pgsql-admin by date

  From Date Subject
Next Message Loïc TREGOUËT 2000-04-19 12:14:29 array ...
Previous Message Vladimir V. Zolotych 2000-04-19 11:31:56 Re: array ...