Error details in sql (and plpgsql) (possible feature request)

Started by Wim Bertelsalmost 15 years ago2 messagesgeneral
Jump to latest
#1Wim Bertels
wim.bertels@khleuven.be

Hallo,

Using libpqexec many error details can retrieved:
http://www.postgresql.org/docs/8.4/interactive/libpq-exec.html
(such as PG_DIAG_SEVERITY, PG_DIAG_MESSAGE_HINT,
PG_DIAG_STATEMENT_POSITION.. as on the site above)
eg:
http://pgsql.privatepaste.com/656698b511

but when u try to trap/catch all these errors,
this doesnt seem possible from withing plpgsql,
where we only have SQLSTATE and SQLERRM
eg.
http://www.postgresql.org/docs/current/interactive/plpgsql-control-structures.html
http://pgsql.privatepaste.com/3b71488e8a

So i think it would be interesting to be able to access the other error
details as given by libpg-exec as well.
Eg adding SEVERITY, MESSAGE_HINT, STATEMENT_POSITION, ..
where we now only have SQLSTATE and SQLERRM

mvg,
Wim

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Wim Bertels (#1)
Re: Error details in sql (and plpgsql) (possible feature request)

Hello

2011/6/22 Wim Bertels <wim.bertels@khleuven.be>:

Hallo,

Using libpqexec many error details can retrieved:
http://www.postgresql.org/docs/8.4/interactive/libpq-exec.html
(such as PG_DIAG_SEVERITY, PG_DIAG_MESSAGE_HINT,
PG_DIAG_STATEMENT_POSITION.. as on the site above)
eg:
http://pgsql.privatepaste.com/656698b511

but when u try to trap/catch all these errors,
this doesnt seem possible from withing plpgsql,
where we only have SQLSTATE and SQLERRM
eg.
http://www.postgresql.org/docs/current/interactive/plpgsql-control-structures.html
http://pgsql.privatepaste.com/3b71488e8a

So i think it would be interesting to be able to access the other error
details as given by libpg-exec as well.
Eg adding SEVERITY, MESSAGE_HINT, STATEMENT_POSITION, ..
where we now only have SQLSTATE and SQLERRM

Patch for access to hint, detail, context is in process this commitfest.

Regards

Pavel Stehule

Show quoted text

mvg,
Wim

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