serial type (text instead of integer) and duplicate keys
От | Carlos Costa |
---|---|
Тема | serial type (text instead of integer) and duplicate keys |
Дата | |
Msg-id | afa69462050412044472b668b3@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: serial type (text instead of integer) and duplicate
|
Список | pgsql-general |
Hello all! There is an extrange error in my logfile: update articles set online='t' where id = 391 ; ERROR: duplicate key violates unique constraint "articles_pkey" (the error exists only with this id) I've checked (well, almost imposible) if there was more than one article with this id: select count(*) from articles where id=391 ; count ------- 1 (1 row) Then, I checked the table: Table "public.articles" Column | Type | Modifiers -------------------+------------------------+----------------------------------------------------- id | integer | not null default nextval('"articles_id_seq"'::text) Here is the origin of my problem, I think: "text". "text"?. The "serial" type generate text instead of integer. Really extrange. So, my next query: select id from articles where id like '%391%' ; id ----- 391 391 (2 rows) The problem is easy to solve: delete and re-create the rows. But I would like to know the origin of this error. Any tip? Thanks in advance, Carlos -- [ http://www.improveyourweb.com/ ] web.log.about.web.development
В списке pgsql-general по дате отправления: