Re: [BUGS] BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Henry Combrinck <henry(at)zen(dot)co(dot)za>, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code
Date: 2008-06-01 23:19:49
Message-ID: 28467.1212362389@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Joe Conway <mail(at)joeconway(dot)com> writes:
> [ improved patch ]

Still a couple quibbles:

> + ereport(level,
> + (errcode(sqlstate),
> + errmsg(message_primary),

This *must* be errmsg("%s", message_primary), else you have big problems
with % in the text. Also, I think it's at least theoretically possible
for message_primary to be null, in which case you'd better substitute
"unknown error" or some such.

You could avoid the ugly cast-away-const by making
dblink_context_conname be const char *, no?

Since dblink_res_error isn't going to return if fail = true, seems
like you could skip the "if (!fail)" tests occurring after calls to it.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Joe Conway 2008-06-01 23:58:05 Re: [BUGS] BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code
Previous Message Joe Conway 2008-06-01 22:05:04 Re: [BUGS] BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2008-06-01 23:58:05 Re: [BUGS] BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code
Previous Message Joe Conway 2008-06-01 22:05:04 Re: [BUGS] BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code