Skip site navigation (1) Skip section navigation (2)

Re: OID assistance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Spiegelberg <gspiegelberg(at)cranel(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: OID assistance
Date: 2005-02-18 16:19:14
Message-ID: 18727.1108743554@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-admin
Greg Spiegelberg <gspiegelberg(at)cranel(dot)com> writes:
> Tom Lane wrote:
>> Exactly how are you "using OIDs to store files"?  Do you mean you're
>> using large objects?

> The table is

>                             Table "public.imgs"
>    Column  |  Type  |                      Modifiers
> ----------+--------+------------------------------------------------------
>   id       | bigint | not null default nextval('public.imgs_id_seq'::text)
>   file     | text   |
>   contents | oid    |
> Indexes: imgs_pkey primary key btree (id)

> Data is loaded using INSERT's.

> insert into imgs values (1,'/path/to/myfile',lo_import('/path/to/myfile'));

Well, put a unique index on the contents column.  Better to fail an
insert than to get a conflict of LO OIDs.

If you were on 7.4 or later you could do ALTER TABLE SET WITHOUT OIDS so
you'd not be sucking up OIDs for the table rows themselves.  On 7.3 the
only way would be to drop and recreate the larger tables WITHOUT OIDS,
which is probably going to be painful :-(.

			regards, tom lane

In response to

Responses

pgsql-admin by date

Next:From: Greg SpiegelbergDate: 2005-02-18 16:27:24
Subject: Re: OID assistance
Previous:From: David.JacquesDate: 2005-02-18 16:13:39
Subject: Libpq: Passing a Pgconn* object between console applications ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group