Re: Table Design question for gurus (without going to "NoSQL")... - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Table Design question for gurus (without going to "NoSQL")...
Date
Msg-id 201111201149.44009.adrian.klaver@gmail.com
Whole thread Raw
In response to Re: Table Design question for gurus (without going to "NoSQL")...  (Phoenix Kiula <phoenix.kiula@gmail.com>)
List 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 by date:

Previous
From: Cédric Villemain
Date:
Subject: Re: How to install pgfincore with PG 9.1
Next
From: Bill Moran
Date:
Subject: Re: Significant Digits in Floating Point Datatype