Re: altering a table to set serial function

Поиск
Список
Период
Сортировка
От Pierre-Frédéric Caillaud
Тема Re: altering a table to set serial function
Дата
Msg-id opsbug9reqcq72hf@musicbox
обсуждение исходный текст
Ответ на altering a table to set serial function  (Prabu Subroto <prabu_subroto@yahoo.com>)
Список pgsql-general
create table foo
(
    salesid serial primary key
);

    serial is a type thus you can't say "serial int4". serial already implies
integer. bigserial implies bigint. primary key tells postgres to create
the appropriate index.



On Tue, 27 Jul 2004 10:16:11 -0700 (PDT), Prabu Subroto
<prabu_subroto@yahoo.com> wrote:

> Dear my friends...
>
> I am using postgres 7.4 and SuSE 9.1.
>
> I want to use auto_increment as on MySQL. I look up
> the documentation on www.postgres.com and I found
> "serial" .
>
> But I don't know how to create auto_increment.
> here is my try:
> "
> kv=# alter table sales alter column salesid int4
> serial;
> ERROR:  syntax error at or near "int4" at character 40
> "
>
> Please tell me the correct command to that.
>
> Thank you very much in advance.
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - Helps protect you from nasty viruses.
> http://promotions.yahoo.com/new_mail
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>



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

Предыдущее
От: Pierre-Frédéric Caillaud
Дата:
Сообщение: Re: Before/After trigger sequencing questiont
Следующее
От: Pierre-Frédéric Caillaud
Дата:
Сообщение: Re: altering a table to set serial function