BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code - Mailing list pgsql-bugs

From Henry Combrinck
Subject BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code
Date
Msg-id 200805271513.m4RFDQ9a004292@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4203
Logged by:          Henry Combrinck
Email address:      henry@zen.co.za
PostgreSQL version: 8.2.6 and 8.3.1
Operating system:   Linux
Description:        perform dblink() in begin/exception returns wrong
SQLSTATE code
Details:

Apologies if this is the wrong forum to report this (perhaps it needs to go
to the dblink() maintainer?)

In a function on a machine using 8.2.6, the following returns a strange
SQLSTATE code:

begin
  perform dblink ('host=other_machine ...',
        'insert into table...');
exception when others then
  raise notice 'SQLSTATE: %', SQLSTATE;
end;

The code returned is always 42601 (syntax_error) irrespective of the actual
error (eg, unique_violation).

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #4196: Backend crash possible with psql
Next
From: Tom Lane
Date:
Subject: Re: BUG #4203: perform dblink() in begin/exception returns wrong SQLSTATE code