Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 
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@xxxxxxxxx

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux