Re: sequence last_value
От | Duncan Adams (DNS) |
---|---|
Тема | Re: sequence last_value |
Дата | |
Msg-id | C54EF5B83335D311BCB50000C11042B102C8C68A@vodabemail1.vodacom.co.za обсуждение исходный текст |
Ответ на | sequence last_value ("Duncan Adams (DNS)" <duncan.adams@vcontractor.co.za>) |
Список | pgsql-novice |
thanx to all for the replies fixed the problem by manually (postgres would not allow me to get a script (PHP) to do it) repeating an insert sql command until the last_value field on location_key_location_seq was above 47. (the last index) haven't had any more problems. still a little worried about how this happened and thank goodness the table was small and not the cable information table. -----Original Message----- From: Josh Berkus [mailto:josh@agliodbs.com] Sent: Friday, October 12, 2001 8:50 PM To: Duncan Adams (DNS); 'pgsql-novice@postgresql.org' Subject: Re: [NOVICE] sequence last_value >> wireman=# insert into loc values (1,1,'HELP'); >> ERROR: Cannot insert a duplicate key into unique index loc_pkey >Try this instead: >INSERT INTO loc ( building_key, floor, ref ) >VALUES (1, 1, 'Help'); >Explicit column naming in INSERTs is always a good idea. was giving me the same error, found that if I added the index it worked, provided that the index was not in use. but who wants to find the last index every time you do an insert :{ >Also, upgrading to 7.1.3 would be a good idea, although unrelated to >your problem. spoken to sys admin and arranged downtime. Been trying to get him to do it for a long time and thanx to your mail he is gona do it. >Finally, SERIAL and NEXTVAL sequences do not work properly in older >versions of pgODBC, if you're using a WIndows client. Upgrading to the >new pgAdmin will solve this. wilco. >-Josh Berkus >If you have dropped table, it would be necessary to drop >key_location_seq explicitly. you have to otherwise postgres will not allow you to recreate the table, it looks as if postgres drop's the index (_pkey) table when the table is dropped, is this correct? and when you say explicitly is this the same as drop sequence? >Vijay
В списке pgsql-novice по дате отправления: