Re: [SQL] nexval error duplicate key

From: ron <ron(at)sattargroup(dot)com>
To: James Orr <james(at)lrgmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [SQL] nexval error duplicate key
Date: 2002-02-15 20:57:53
Message-ID: a05100307b893255947c3@[10.0.1.5]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>Hi Ron,
>
>On Thu, 14 Feb 2002, ron wrote:
>
>> I set up a table
>>
>> field
>> id
>> name_insert
>>
>> I used the code something like the following:
>>
>> CREATE TABLE name_table (
>> id SERIAL,
>> name_insert TEXT
>> );
>>
>>
>> When I use postgresql admin I get DATA 2
>> the number is OUT of order
>
>Order doesn't matter.

**** some how it got deleted here ****

I would update one of the records in the middle so that the number
sheme would be like

1 john
2 mary
3 smith

then in the modification it would be (if I modified 2 mary)

1 john
3 smith
2 bertha

Then if I added a new record I would get a duplication error

>
>> NOW when I add a new value
>>
>> it give me an error that states:
>>
>> --------------------------------------------------------
>>
>> Error Occurred While Processing Request
>>
>> Error Diagnostic Information
>>
>> ODBC Error Code = 08S01 (Communication link failure)
>>
>> Error while executing the query; ERROR: Cannot insert a duplicate key
>> into unique index name_pkey
>>
>> The error occurred while processing an element with a general
>> identifier of (CFQUERY), occupying document position (1:61) to
>> (1:110).
>> --------------------------------------------------------
>
>What does your INSERT statement look like? You'd want something like
>this ...
>
>INSERT INTO name_table (name_insert) VALUES ("Mary");
>
>This lets postgres deal with the id numbering itself.
>
>- James

Yip I use

<CFQUERY datasource="data_name" NAME="field_name">

INSERT INTO field_here

(
field_go_here
)

VALUES

(
'information'
)

</cfquery>

this is here then when I update then insert that's when I get the error

Ron Sattar

--

Sattar Group, Inc. ICQ 153 46 249
Voice 773 725 3445 Fax 773 442 0064
http://www.SattarGroup.com

Browse pgsql-general by date

  From Date Subject
Next Message Phil Glatz 2002-02-15 21:08:54 Re: Question: Who's Using Postgres
Previous Message Jeff Davis 2002-02-15 20:43:40 Re: Question: Who's Using Postgres