Re: sequence last_value

From: "Duncan Adams (DNS)" <duncan(dot)adams(at)vcontractor(dot)co(dot)za>
To: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: sequence last_value
Date: 2001-10-15 15:11:35
Message-ID: C54EF5B83335D311BCB50000C11042B102C8C68A@vodabemail1.vodacom.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)agliodbs(dot)com]
Sent: Friday, October 12, 2001 8:50 PM
To: Duncan Adams (DNS); 'pgsql-novice(at)postgresql(dot)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

Browse pgsql-novice by date

  From Date Subject
Next Message Francisco Reyes 2001-10-16 02:31:24 Where info on new releases?
Previous Message hodges 2001-10-15 12:41:44 Re: [PHP] encryption for postgres