pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Support <support@insyde.com.br>
To: pgsql-odbc@postgresql.org
Subject: problem on treatment when add a duplicate primary key
Date: Tue, 4 Feb 2003 08:46:25 -0200
Message-ID: <001201c2cc3a$ab175e00$1bfaabc8@insyde> (raw)

Hi,
I'm getting an error when I try to insert a duplicated value in
a primary key or unique index.
I know I can't insert so I'll explain the thing:

When I insert the first time the row, it works
but if I try to re-insert it simply crashes my application,
giving me errors that I couldn't treat (I can treat this error in
MSSQL ODBC Driver and MySQL ODBC Driver).

Browsing the source I found that this was missing (please correct if wrong):

environ.c

   case ERROR_DUPLICATED_ENTRY:
    pg_sqlstate_set(env, szSqlState, "23000", ??????);
    // entry already exists
    break;
   case ERROR_DUPLICATED_KEY:
    pg_sqlstate_set(env, szSqlState, "23000", ???????);
    // key already exists
    break;
(didn't find the second code yet. What is it?)
statement.h

    #define ERRROR_DUPLICATED_ENTRY      34
    #define ERRROR_DUPLICATED_KEY           35
(next numbers of the sequence)

I'm still investigating, but if any of you know about it,
let me know.

I also don't know if ERRROR_DUPLICATED_ENTRY
and ERRROR_DUPLICATED_KEY are valid return codes
and where to put them. If someone can help.

TIA,
Ricardo







view thread (3+ messages)  latest in thread

Message-ID: <001201c2cc3a$ab175e00$1bfaabc8@insyde>
Permalink:  ../001201c2cc3a$ab175e00$1bfaabc8@insyde/
Also on:    postgresql.org/message-id/001201c2cc3a$ab175e00$1bfaabc8@insyde

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: support@insyde.com.br
  Subject: Re: problem on treatment when add a duplicate primary key
  In-Reply-To: <001201c2cc3a$ab175e00$1bfaabc8@insyde>
  References: <001201c2cc3a$ab175e00$1bfaabc8@insyde>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox