Re: Table Design question for gurus (without going to "NoSQL")...

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Table Design question for gurus (without going to "NoSQL")...
Дата
Msg-id 201111201149.44009.adrian.klaver@gmail.com
обсуждение исходный текст
Ответ на Re: Table Design question for gurus (without going to "NoSQL")...  (Phoenix Kiula <phoenix.kiula@gmail.com>)
Список pgsql-general
On Sunday, November 20, 2011 7:12:59 am Phoenix Kiula wrote:
> On Sun, Nov 20, 2011 at 9:33 PM, Phoenix Kiula <phoenix.kiula@gmail.com>
wrote:

>
> I thought of adding a bigserial (serial8) column instead of
> varchar(32) for the md5. But postgresql tells me that:
>
> --
> ERROR:  type "bigserial" does not exist
> --
>
> Why is this? Why can't I create a column with this "type"? Whats the
> current syntax?

bigserial is not a type so much as a macro that creates a bigint column with
attached sequence.

Example:

test(5432)aklaver=>\d pk_test
                                                           
    Table "public.pk_test"
                                                           
 Column |  Type   | Modifiers
--------+---------+-----------
 id     | integer | not null
 fld_1  | text    |
Indexes:
    "pk" PRIMARY KEY, btree (id)

test(5432)aklaver=>ALTER TABLE pk_test ADD column bg bigserial;
NOTICE:  ALTER TABLE will create implicit sequence "pk_test_bg_seq" for serial
column "pk_test.bg"
ALTER TABLE
test(5432)aklaver=>\d pk_test
                         Table "public.pk_test"
 Column |  Type   |                      Modifiers
--------+---------+------------------------------------------------------
 id     | integer | not null
 fld_1  | text    |
 bg     | bigint  | not null default nextval('pk_test_bg_seq'::regclass)
Indexes:
    "pk" PRIMARY KEY, btree (id)

>
> Thanks.

--
Adrian Klaver
adrian.klaver@gmail.com

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

Предыдущее
От: Cédric Villemain
Дата:
Сообщение: Re: How to install pgfincore with PG 9.1
Следующее
От: Bill Moran
Дата:
Сообщение: Re: Significant Digits in Floating Point Datatype