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

User-defined error messages

From: Vince Gonzalez <vince(at)baruch(dot)cuny(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: User-defined error messages
Date: 2000-01-27 23:06:07
Message-ID: (view raw or whole thread)
Lists: pgsql-sql

Is it possible to create user-defined error messages in functions?
For example, I'd like for an update to a table to fail with a message like
'You need to check your privileges' as opposed to 'Permission Denied'.
I'd like to avoid parsing the messages actually returned by the server,
as these could change from revision to revision.  Should I do this by
crafting each function to return an error code that I define, and then
use that code to index a table?  I'm interested to hear any solutions
people may have come up with.

I seem to remember there being some sort of exception facility, but I
can't remember where I may have seen it (or I could be crazy).

My application is written in Java, if that matters.


pgsql-sql by date

Next:From: Vince GonzalezDate: 2000-01-27 23:13:28
Subject: User-defined error messages/codes
Previous:From: Peter EisentrautDate: 2000-01-27 22:28:04
Subject: Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace

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