|
Home > Archive > PostgreSQL Bugs > December 2005 > BUG #2103: System column oid is not unique
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
BUG #2103: System column oid is not unique
|
|
| wangshj 2005-12-09, 11:24 am |
|
The following bug has been logged online:
Bug reference: 2103
Logged by: wangshj
Email address: wangshj@sduept.com
PostgreSQL version: 8.1.0
Operating system: CentOS 4
Description: System column oid is not unique
Details:
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.
[color=darkred]
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_pk
ey" 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.
[color=darkred]
oidtest=# INSERT INTO oidtestpk_another(na
me) VALUES ('name63');
INSERT 54563 1
oidtest=# INSERT INTO oidtestpk_another(na
me) 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 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
| |
| Tom Lane 2005-12-09, 11:24 am |
| "wangshj" <wangshj@sduept.com> writes:
> Description: System column oid is not unique
There isn't, and never has been nor will be, any promise that it is,
except to the extent that uniqueness is enforced by a unique index
on a particular table. OID is just a kind of serial sequence generator.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
|
|
|
|
|