Re: [GENERAL] Simple problem?

Поиск
Список
Период
Сортировка
От Steve Wolfe
Тема Re: [GENERAL] Simple problem?
Дата
Msg-id 002301bf852c$aa48dba0$85755ad1@iboats.com
обсуждение исходный текст
Ответ на Simple problem?  (Stan Jacobs <jacobs@jtek.com>)
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Ed Loehr
Дата:
Сообщение: Re: [GENERAL] How to configure PostgreSQL for PHP access & postgresadmin
Следующее
От: Chris Jones
Дата:
Сообщение: database corruption?