pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hiroshi Inoue <Inoue@tpf.co.jp>
To: Support <support@insyde.com.br>
Cc: pgsql-odbc@postgresql.org
Subject: Re: error 23000 is not treated in psqlODBC
Date: Tue, 11 Feb 2003 09:29:33 +0900
Message-ID: <3E4843ED.27E84673@tpf.co.jp> (raw)
References: <000901c2d12a$8b718720$1afaabc8@insyde>

Support wrote:
> 
> "For example. you could have MS SQL Server and PostgreSQL servers
> that have exactly the same data. Using ODBC, your Windows application
> would make exactly the same calls and the back-end data source would
> look the same (to the Windows application)." - PostgreSQL 7.2
> Documentation - chap. 7. ODBC Interface
> 
> This should happen when I use my system. It works with MySQL and MS SQL
> Server, so it would work with PostgreSQL also, without any change. The
> problem I found is that psqlODBC do not validate all the error codes
> specified by ODBC. The error I related should return "23000/S1010"
> acording to ODBC.
> 
> Seeking psqlODBC sources, I found some of this informations/errors were
> treated at environ.c, under a 'case' where most of the psqlODBC errors
> were treated. Following this logic, this is where I should insert
> my code:
> 
> case ER_DUP_KEY:
> pg_sqlstate_set(env, szSqlState, "23000", "S1010");
> // key already exists
> break;
> 
> This would return the error code I need to treat qhe the user tries to
> insert a duplicated key.

Unfortunately PostgreSQL doesn't support error code at
backend side and it's very hard for clients to detect
error details such as *key already exists*. 
There may be a way where we analyze the error message
but I won't do it.

regards,
Hiroshi Inoue
	http://www.geocities.jp/inocchichichi/psqlodbc/



view thread (2+ messages)

Message-ID: <3E4843ED.27E84673@tpf.co.jp>
Permalink:  ../3E4843ED.27E84673@tpf.co.jp/
Also on:    postgresql.org/message-id/3E4843ED.27E84673@tpf.co.jp

 · 

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: Inoue@tpf.co.jp, support@insyde.com.br
  Subject: Re: error 23000 is not treated in psqlODBC
  In-Reply-To: <3E4843ED.27E84673@tpf.co.jp>
  References: <000901c2d12a$8b718720$1afaabc8@insyde> <3E4843ED.27E84673@tpf.co.jp>

* 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