Обсуждение: regarding oid(object id)

Поиск
Список
Период
Сортировка

regarding oid(object id)

От
siva kiran balijepalli
Дата:
Hi
i am novice postgr sql user.
 
I have created a table named customer in my data base.
also i have inserter some of the rows into my table.
when i try to execute this command to select object id's (oid) i am getting following error.
 
select oid from customer;
error: column oid doesn't exist
 
note: even though i have changed the
default_with_oids = on in postgreconf file,i am not getting the oid's.
 
my postgre sql version is 8.4
 
but when i try to select oid's for already existed tables in pg_catalogue the output is coming
for eg: select oid from pg_proc;
 
please reply
 
thanks & regards
sivakiran.B

Re: regarding oid(object id)

От
Chetan Suttraway
Дата:


On Thu, Mar 10, 2011 at 12:31 PM, siva kiran balijepalli <b.sivakiran@gmail.com> wrote:
Hi
i am novice postgr sql user.
 
I have created a table named customer in my data base.
also i have inserter some of the rows into my table.
when i try to execute this command to select object id's (oid) i am getting following error.
 
select oid from customer;
error: column oid doesn't exist
 
note: even though i have changed the
default_with_oids = on in postgreconf file,i am not getting the oid's.
 
my postgre sql version is 8.4
 
but when i try to select oid's for already existed tables in pg_catalogue the output is coming
for eg: select oid from pg_proc;
 
please reply
 
thanks & regards
sivakiran.B

let me share this simple test case:
pg=# create table myt(a int)with oids;
CREATE TABLE
pg=# select * from myt;
 a
---
(0 rows)

pg=# insert into myt values(1);
INSERT 16387 1

pg=# select a, oid from myt;
 a |  oid 
---+-------
 1 | 16387
(1 row)

Please read this section:
http://www.postgresql.org/docs/9.0/static/sql-createtable.html
http://www.postgresql.org/docs/9.0/static/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS

--
Chetan Sutrave
Senior Software Engineer
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Phone: +91.20.30589523

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the individual or entity to whom it is addressed. This message contains information from EnterpriseDB Corporation that may be privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient or authorized to receive this for the intended recipient, any use, dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete this message.

Re: regarding oid(object id)

От
Vibhor Kumar
Дата:
On Mar 10, 2011, at 12:31 PM, siva kiran balijepalli wrote:

> Hi
> i am novice postgr sql user.
>
> I have created a table named customer in my data base.
> also i have inserter some of the rows into my table.
> when i try to execute this command to select object id's (oid) i am getting following error.
>
> select oid from customer;
> error: column oid doesn't exist

For old/Existing Table without OID, you can't get OID.

> note: even though i have changed the
> default_with_oids = on in postgreconf file,i am not getting the oid's.
>
Setting Above parameter will make sure that new tables will get created with OIDs.
i.e you don't have to mention WITH OID in CREATE TABLE Syntax.


Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor.kumar@enterprisedb.com
Blog:http://vibhork.blogspot.com