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