dbTalk Databases Forums  

[BUGS] pgsql8.1: About COPY Command and system clomn oid

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] pgsql8.1: About COPY Command and system clomn oid in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
wangshj
 
Posts: n/a

Default [BUGS] pgsql8.1: About COPY Command and system clomn oid - 12-09-2005 , 10:22 AM






The following is my test.

oidtest=# CREATE TABLE oidtest( name text ) WITH OIDS;
CREATE TABLE
oidtest=# INSERT INTO oidtest ( name ) VALUES( 'name1' ) ;
INSERT 54512 1
oidtest=# COPY oidtest (name) WITH OIDS FROM stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
Quote:
54513 copyname
\.
oidtest=# INSERT INTO oidtest ( name ) VALUES( 'name2' ) ;
INSERT 54513 1
oidtest=# SELECT oid,name from oidtest ;
oid | name
-------+----------
54512 | name1
54513 | copyname
54513 | name2
(3 rows)

oidtest=#
Then I got two records with same oid(54513).

In the second test, I created two tables and added primary key (oid) to
them. As below:

oidtest=# CREATE TABLE oidtestpk (name text, PRIMARY KEY (oid) ) WITH OIDS ;
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"oidtestpk_pkey" for table "oidtestpk"
CREATE TABLE
oidtest=# CREATE TABLE oidtestpk_another (name text, PRIMARY KEY (oid) )
WITH OIDS ;
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"oidtestpk_another_pkey" for table "oidtestpk_another"
CREATE TABLE
oidtest=# INSERT INTO oidtestpk(name) VALUES ('name0');
INSERT 54562 1
oidtest=# COPY oidtestpk(name) WITH OIDS FROM stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
Quote:
54564 copyname64
\.
oidtest=# INSERT INTO oidtestpk_another(name) VALUES ('name63');
INSERT 54563 1
oidtest=# INSERT INTO oidtestpk_another(name) VALUES ('name64');
INSERT 54564 1
oidtest=# SELECT oid,name FROM oidtestpk where oid=54564;
oid | name
-------+------------
54564 | copyname64
(1 row)

oidtest=# SELECT oid,name FROM oidtestpk_another where oid=54564;
oid | name
-------+--------
54564 | name64
(1 row)

And then I got records with same oid(54564).
Is it a bug?
....

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


Reply With Quote
  #2  
Old   
Qingqing Zhou
 
Posts: n/a

Default Re: [BUGS] pgsql8.1: About COPY Command and system clomn oid - 12-10-2005 , 01:12 PM







"wangshj" <wangshj (AT) sduept (DOT) com> wrote
Quote:
oidtest=# COPY oidtest (name) WITH OIDS FROM stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
54513 copyname
\.
oidtest=# INSERT INTO oidtest ( name ) VALUES( 'name2' ) ;
INSERT 54513 1
oidtest=# SELECT oid,name from oidtest ;
oid | name
-------+----------
54512 | name1
54513 | copyname
54513 | name2
(3 rows)

oidtest=#
Then I got two records with same oid(54513).

This is not a bug. You can specify any valid number here as Oids. If you
don't want duplicated Oids or strange Oids, then don't specify WITH OIDS
clause.

Regards,
Qingqing



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.