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

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>
Subject: Re: Table Design question for gurus (without going to "NoSQL")...
Date: 2011-11-20 19:49:43
Message-ID: 201111201149.44009.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)kiula(at)gmail(dot)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(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2011-11-20 19:56:01 Re: Significant Digits in Floating Point Datatype
Previous Message Cédric Villemain 2011-11-20 19:36:29 Re: How to install pgfincore with PG 9.1