[GENERAL] serial type (text instead of integer) and duplicate keys

2005-04-12 Thread Carlos Costa
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:

Re: [GENERAL] serial type (text instead of integer) and duplicate

2005-04-12 Thread Richard Huxton
Carlos Costa wrote: 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

Re: [GENERAL] serial type (text instead of integer) and duplicate keys

2005-04-12 Thread Carlos Costa
Thank you very much. Here is the output: SELECT oid,xmin,xmax,ctid,id FROM articles WHERE id=391; oid | xmin| xmax| ctid | id -+---+---+--+- 3032469 | 152691945 | 152886684 | (104,6) | 391 3032469 | 152886687 | 156995994 | (104,13) | 391

Re: [GENERAL] serial type (text instead of integer) and duplicate keys

2005-04-12 Thread Tom Lane
Carlos Costa [EMAIL PROTECTED] writes: SELECT oid,xmin,xmax,ctid,id FROM articles WHERE id=391; oid | xmin| xmax| ctid | id -+---+---+--+- 3032469 | 152691945 | 152886684 | (104,6) | 391 3032469 | 152886687 | 156995994 | (104,13) |

Re: [GENERAL] SERIAL type - auto-increment grouped by other field

2004-06-09 Thread Paulovi Michal
:(( sorry At server ther is istalled pgsql 7.1.2 but creatlang works from 7.2.X and upper version :( do you have any other ideas?? elein wrote: You just need to define 'plpgsql' as a language in your database. At the shell, to define the language use: createlang 'plpgsql' dbname; After

[GENERAL] serial type vs. sequences

2003-11-12 Thread Suchandra Thapa
I was wondering if there was a reliable method to get the last id inserted into a serial column in a table. I believe previous recommendations given were to use a sequence, have your app get the nextval for the sequence and then use that in the insert. I was wondering if things had changed or if

Re: [GENERAL] Serial Type

2001-05-02 Thread Justin Clift
Hi Chris, If you do an INSERT straight into the table, AND also make sure you give it the value you want in the serial column, it will accept it and not increment the serial column's counter. There are also a few function which are useful with the serial type : currval() setval() nextval()

Re: [GENERAL] Serial Type

2001-05-02 Thread Peter Eisentraut
Christian Marschalek writes: The serial data type automaticaly takes the next higher value, but what if there's a drop and I want to assing 3 even if there are 20 records and the next higher number would be 21 not 3? Then you can't use the serial type. Coding hole-filling serial numbers can

[GENERAL] serial type

1999-09-27 Thread Greg Beams
I'm trying to create a table as such: create table comment (rec_id serial, locale varchar(50), ...) It creates correctly, telling me that it will create an implicit sequence for the serial column, and an implicit index for the table. But, when I try to insert a record into the database