Re: oid or without oid ...

From: Raimon Fernandez <coder(at)montx(dot)com>
To: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: oid or without oid ...
Date: 2007-05-22 10:05:46
Message-ID: 42FD0AF0-D6FB-492A-A28B-616DD01CD661@montx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I'm trying with this approach:

create table public.articles( "id" int4 not null default nextval
('articles_id_seq'::regclass) , "referencia" varchar not null
)
WITHOUT OIDS;
ALTER table "public"."articles" OWNER TO "postgres";
ALTER table "public"."articles" SET WITHOUT CLUSTER;
alter table "public"."articles" add primary key(id);

and after some test, it works ...

thanks for the advice!

regards,

raimon

On 22/05/2007, at 11:57, Sean Davis wrote:

> On Tuesday 22 May 2007 03:30, Raimon Fernandez wrote:
>> Hello again,
>>
>>
>> In my previous databases development, I've been using always a unique
>> longint number for identifying each record.
>>
>> In PostgreSQL I can see that it has the oid, he can do it for you.
>>
>> Also I see that is an optional parameter, and after surfing the web,
>> I could find some people that say never use them, an another ones
>> that you can use it ...
>>
>> Any extra advice would be perfectly before creating the database, if
>> it's better for now and future to use oid or simply create an id
>> field as a serial or something similar.
>
> In general, the recommendation is not to use OIDs. Use serial
> columns (or
> some other primary key) instead.
>
> Sean
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Sean Davis 2007-05-22 10:08:41 Re: oid or without oid ...
Previous Message Sean Davis 2007-05-22 09:57:09 Re: oid or without oid ...