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

RE: Error handling in ODBC

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: "'Hiroshi Inoue'" <Inoue(at)tpf(dot)co(dot)jp>, Zoltan Kovacs <tip(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>
Cc: pgsql-odbc <pgsql-odbc(at)postgresql(dot)org>
Subject: RE: Error handling in ODBC
Date: 2001-06-14 08:04:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue(at)tpf(dot)co(dot)jp] 
> Sent: 14 June 2001 07:27
> To: Zoltan Kovacs
> Cc: pgsql-odbc
> Subject: [ODBC] Error handling in ODBC
> Hi all,
> Recently I found the case that  NOTICE causes an error in 
> ODBC while examining Kristis' error report.
> It seems that NOTICE had never been the cause of SQL_ERROR 
> before Zoltan's change about a year ago. Before his change 
> *NOTICE* only caused a PGRES_NONFATAL_ERROR and SC_execute() 
> returned SQL_SUCCESS_WITH_INFO. However currently *ERROR* 
> also causes a PGRES_NONFATAL_ERROR and SC_Execute() returns 
> SQL_ERROR. Why was this changed ? I'd like to put it back if 
> there's no reason.


Actually this is a big problem for me (not what you are proposing, but
NOTICES in general). I'm trying to implement EXPLAIN in pgAdmin. Query Plans
are returned by the backend in a notice, which the ODBC driver happily seems
to log (if logging is switched on) and then do nothing with them (from

							case 'N':
SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
from backend during clear: '%s'\n", cmdbuffer);

			case 'N':			/* NOTICE: */
				SOCK_get_string(sock, cmdbuffer,

				res = QR_Constructor();
				QR_set_status(res, PGRES_NONFATAL_ERROR);
				QR_set_notice(res, cmdbuffer);	/* will dup
this string */

				mylog("~~~ NOTICE: '%s'\n", cmdbuffer);
				qlog("NOTICE from backend during send_query:
'%s'\n", cmdbuffer);


As far as I can tell, it is then not possible to access the notice from a
client app (cetainly SQLError won't return it in my test prog, yet I can
quite happily get a real error from an invalid query for example.

As I said, this is a real issue for me, obviously NOTICEs probably shouldn't
raise an error that a client app might think is an actual problem, on the
other hand it would be *really* useful to be able to access them somehow.
The only way I could think of that's not completely horrendous would be to
add another info type to SQLGetInfo - say PGLastNotice.

Regards, Dave.


pgsql-odbc by date

Next:From: Hiroshi InoueDate: 2001-06-14 10:08:46
Subject: Re: Error handling in ODBC
Previous:From: Hiroshi InoueDate: 2001-06-14 06:51:18
Subject: Re: ODBC Interface version 07_01_0005, problem with C++ exceptions

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