![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to debug some problem in my database that is resulting in an error of the form "Cannot insert a duplicate key into unique index". The insert statement that is producing this error does not include a value for the pkey field in question (this field is of type SERIAL). I imagine that somehow the counter associated with this field got messed up, so that it is mistakenly generating a value that has been used already. How can I straighten it out? Thanks! kj ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
#3
| |||
| |||
|
|
The insert statement that is producing this error does not include a value for the pkey field in question (this field is of type SERIAL). I imagine that somehow the counter associated with this field got messed up, so that it is mistakenly generating a value that has been used already. How can I straighten it out? |
#4
| |||
| |||
|
|
The insert statement that is producing this error does not include a value for the pkey field in question (this field is of type SERIAL). I imagine that somehow the counter associated with this field got messed up, so that it is mistakenly generating a value that has been used already. How can I straighten it out? |
#5
| |||
| |||
|
#6
| |||
| |||
|
#7
| |||
| |||
|
| You can list all the sequences: select relname from pg_class where relkind='S'; and list all their atributes: select * from sequence_name; See "System Catalogs" in the documentation! DAQ ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your message can get through to the mailing list cleanly |
#8
| |||
| |||
|
#9
| |||
| |||
|
|
kpc> How can I list all the sequences in the database, with their kpc> attributes (such as last_value)? (I'm having a hard time guessing kpc> 'seq-name'; the 'A_id_seq' formula did not work.) You can list all the sequences: select relname from pg_class where relkind='S'; and list all their atributes: select * from sequence_name; |
#10
| |||
| |||
|
|
Warning: PostgreSQL query failed: ERROR: Cannot insert a duplicate key into unique index fee_uk Check the max value in data base for the same index key and then check if |
![]() |
| Thread Tools | |
| Display Modes | |
| |