Re: duplicate key ?

Поиск
Список
Период
Сортировка
От Ing. Roberto Andrade Fonseca
Тема Re: duplicate key ?
Дата
Msg-id Pine.LNX.4.10.10010210043130.1852-100000@inter.interservice.com.mx
обсуждение исходный текст
Ответ на duplicate key ?  (Sungchul Park <scpark@gen128.com>)
Список pgsql-general
Hi:

On Sat, 21 Oct 2000, Sungchul Park wrote:

> I didn't get any answer about my question posted yesterday.
> please share your knowledge and wisdom with me, a poor s/w engineer.
>
> ---------- Forwarded message ----------
> Date: Fri, 20 Oct 2000 21:30:27 +0900 (KST)
> From: Sungchul Park <scpark@gen128.com>
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] duplicate key ?
>
> Please check following...
>
> Fo2Me=# drop table dirinfo;
> DROP
> Fo2Me=# CREATE TABLE dirinfo(
> Fo2Me(#         code            VARCHAR(8) PRIMARY KEY,
> Fo2Me(#         level           SMALLINT NOT NULL,
> Fo2Me(#         name            TEXT NOT NULL,
> Fo2Me(#         count           SMALLINT NOT NULL DEFAULT 0
> Fo2Me(# );
> NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'dirinfo_pkey'
> for table 'dirinfo'
> CREATE
> Fo2Me=# INSERT INTO dirinfo (code, level, name) VALUES('hbcol', 1, 'abc');
> INSERT 63411 1
> Fo2Me=# INSERT INTO dirinfo (code, level, name) VALUES('hbcrf', 1, 'zzz');
> ERROR:  Cannot insert a duplicate key into unique index dirinfo_pkey
>
> I couldn't understand this error message. What's wrong?
>
> The version of postgresql is 7.0.2 and the database created with EUC_KR encoding.

I just ran:

drop table dirinfo;
CREATE TABLE dirinfo(
         code            VARCHAR(8) PRIMARY KEY,
         level           SMALLINT NOT NULL,
         name            TEXT NOT NULL,
         count           SMALLINT NOT NULL DEFAULT 0
);
INSERT INTO dirinfo (code, level, name) VALUES('hbcol', 1, 'abc');
INSERT INTO dirinfo (code, level, name) VALUES('hbcrf', 1, 'zzz');

without problems:

pruebas=# \i prueba.sql
psql:prueba.sql:1: ERROR:  Relation 'dirinfo' does not exist
psql:prueba.sql:7: NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'dirinfo_pkey' for table
'dirinfo'
CREATE
INSERT 208144 1
INSERT 208145 1
pruebas=# select * from dirinfo ;
 code  | level | name | count
-------+-------+------+-------
 hbcol |     1 | abc  |     0
 hbcrf |     1 | zzz  |     0
(2 rows)

I'm using RH 6.2, and pgsql v. 7.0.2 with Spanish locale.

Just my 2 cents.

Roberto Andrade Fonseca
randrade@abl.com.mx



В списке pgsql-general по дате отправления:

Предыдущее
От: Sungchul Park
Дата:
Сообщение: Re: duplicate key ? (fwd)
Следующее
От: KuroiNeko
Дата:
Сообщение: OT: Phobos devices