Re: [GENERAL] Simple problem?

From: "Steve Wolfe" <steve(at)iboats(dot)com>
To: <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] Simple problem?
Date: 2000-03-03 16:22:27
Message-ID: 002301bf852c$aa48dba0$85755ad1@iboats.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> You can do a SELECT curval('sequence_name'); to get the value you were
just
> assigned without worrying about other people updating, as curval gets the
> current value within the current transaction (or within the current
> session, either way, it works.)

Or, my prefered method, create the table like so..

create table MyTable
(
MyField int4 default nextval('SomeSequence'),

...
);

That gives you the flexibility to select the nextval of the sequence and
insert it yourself (if you need it for further processing), or to simply
let the database take care of it for itself.

steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Jones 2000-03-03 16:38:28 database corruption?
Previous Message Ed Loehr 2000-03-03 16:16:13 Re: [GENERAL] How to configure PostgreSQL for PHP access & postgresadmin