sqlstate is HY000 for not_null_violation

sqlstate is HY000 for not_null_violation

am 20.08.2009 09:47:01 von Nei Kai

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?

Greeatings,
ning

--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Re: sqlstate is HY000 for not_null_violation

am 23.08.2009 11:26:11 von Hiroshi Inoue

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

--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Re: sqlstate is HY000 for not_null_violation

am 27.08.2009 06:28:28 von Nei Kai

Thank you Inoue-san,

By setting in odbc.ini,
Protocol =3D 7.4
I got sqlstate=3D23502 from SQLGetDiagRec() as expected.

Since I am using psqlodbc08.02.0400 with unixODBC connecting to
PostgreSQL8.2.4, I think that setting Protocol=3D8.2.4 is also
reasonable, but that is not true, I got "HY000" by setting to 8.2.4.
I cannot find information about available protocol numbers, could you
help to give a clue?

Greetings,
ning

On Sun, Aug 23, 2009 at 6:26 PM, Hiroshi Inoue wrote:
> ning wrote:
>>
>> Hi,
>>
>> I am using psqlodbc08.02.0400 with unixODBC connecting to PostgreSQL8.2.=
4.
>>
>> For not_null_violation error, like
>> db=3D# create temp table ooid (oid_ integer not null);
>> CREATE TABLE
>> db=3D# 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=3DHY000;SQLCODE=3D7;ERROR:  null value in column "oid_" vi=
olates
>> not-null constraint;Error while executing the query
>>
>> which should be SQLSTATE=3D23502 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
>

--=20
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Re: sqlstate is HY000 for not_null_violation

am 27.08.2009 14:00:33 von Hiroshi Inoue

ning wrote:
> Thank you Inoue-san,
>
> By setting in odbc.ini,
> Protocol = 7.4
> I got sqlstate=23502 from SQLGetDiagRec() as expected.
>
> Since I am using psqlodbc08.02.0400 with unixODBC connecting to
> PostgreSQL8.2.4, I think that setting Protocol=8.2.4 is also
> reasonable, but that is not true, I got "HY000" by setting to 8.2.4.
> I cannot find information about available protocol numbers, could you
> help to give a clue?

The protocol option means FE/BE protocol and must be
6.2, 6.3, 6.4 or 7.4 .

regards,
Hiroshi Inoue

--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc