Re: Auto Increment Questions

Поиск
Список
Период
Сортировка
От John DeSoi
Тема Re: Auto Increment Questions
Дата
Msg-id 77dc08e8d77a32586ce7b912330114b6@pgedit.com
обсуждение исходный текст
Ответ на Auto Increment Questions  ("Michael Avila" <mavila@mich.com>)
Список pgsql-novice
On Jun 4, 2005, at 2:35 PM, Michael Avila wrote:

> In Postgres I see that it is not so automatic and is not truly
> serial/sequential. Reviewing my objectives, I don't think not being
> truly
> serial/sequential will be a problem.  However, I prefer the automated
> part
> versus my having to code additional lines and hits against the
> database.
>
> Questions:
>
> - Is there ever going to be a truly auto increment feature like MySQL
> has?
> If so, any ideas when?
>
> - What is the easiest, shortest, and safest way to code for serial?
>
> - Are there any pitfalls, gotchas that I need to know about using
> serial?


Serial fields are a suitable replacement for auto increment. All you
need to do is declare your column type to be serial or bigserial. If
you have any concerns about having more rows than the serial or
bigserial can represent, declare the column as unique.




John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Wrong SQLSTATE returned?
Следующее
От: John DeSoi
Дата:
Сообщение: Re: Data Store on C: