Skip site navigation (1) Skip section navigation (2)

Re: sqlstate is HY000 for not_null_violation

From: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
To: ning <mailxiening(at)gmail(dot)com>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: sqlstate is HY000 for not_null_violation
Date: 2009-08-23 09:26:11
Message-ID: 4A910B33.2070605@tpf.co.jp (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-odbc
ning wrote:
> Hi,
> 
> I am using psqlodbc08.02.0400 with unixODBC connecting to PostgreSQL8.2.4.
> 
> For not_null_violation error, like
> db=# create temp table ooid (oid_ integer not null);
> CREATE TABLE
> db=# insert into ooid values(NULL);
> ERROR:  null value in column "oid_" violates not-null constraint
> 
> The sqlstate returned by SQLGetDiagRec() is HY000, the message is
> SQLSTATE=HY000;SQLCODE=7;ERROR:  null value in column "oid_" violates
> not-null constraint;Error while executing the query
> 
> which should be SQLSTATE=23502 according to
> http://www.postgresql.org/docs/8.2/static/errcodes-appendix.html
> 
> Any idea to get 23502 instead of HY000?

Which protocol option are you setting ?
You should set the 7.4+ protocol option.

regards,
Hiroshi Inoue

In response to

Responses

pgsql-odbc by date

Next:From: Hiroshi InoueDate: 2009-08-23 09:29:10
Subject: Re: ODBC driver & connection limit
Previous:From: Assaf LavieDate: 2009-08-22 14:43:42
Subject: Re: ODBC 64-bit driver request

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group