Sample Header Ad - 728x90

How to use COLUMN and TABLE options in a RAISE statement

1 vote
1 answer
408 views
According to the docs , there are options to RAISE called TABLE and COLUMN. However , if I explicitly set them, they do not end up in the resulting error message. It seems only DETAIL and HINT are ever used in the error message. How can you get the other options to show up? E.g.:
RAISE EXCEPTION 'invalid_parameter' USING
    DETAIL = FORMAT('The specified user "%s" was not found.', _usr),
    HINT = 'Enter the username of an existing user.',
    COLUMN = 'username',
    TABLE = 'accounts';
Issues an error message:
... ERROR:  invalid_parameter
... DETAIL:  The specified user "aanders" was not found.
... HINT:  Enter the username of an existing user.
... CONTEXT:  PL/pgSQL function _api.find_user(text) line 24 at RAISE
... PL/pgSQL function _api.accounts_update_trigger() line 97 at assignment
... STATEMENT:
...     WITH pg_source AS (...
There is no "TABLE" or "COLUMN" shown. **UPDATE** The key term I needed was "VERBOSITY" - once I searched for that I found duplicate questions, e.g. https://stackoverflow.com/q/41959752/1571426 (not sure if a question on a different forum makes this "duplicate" or not.)
Asked by user9645 (187 rep)
Mar 15, 2019, 03:42 PM
Last activity: Mar 15, 2019, 06:34 PM