Hi all, I have the following defined in my database:
CREATE TYPE side AS ENUM ('right', 'left');
And I've defined a function that with a parameter of this type.
CREATE OR REPLACE FUNCTION test_input ( p_side side ) ...
Now I test the function with an invalid value:
db=# select test_input('blue');
ERROR: invalid input value for enum side: "blue"
I want to trap the exception in my function
WHEN ??? THEN
RAISE EXCEPTION ...
I tried the obvious INVALID_INPUT_VALUE with no success.
1) What is the actual name of the condition (and, yes, I looked through appendix A trying to figure it out) for invalid enum input?
2) Is there a way to retrieve the error code so that I don't have to guess at the condition name? (I've been playing this game a lot with other exceptions and I don't understand WHY the condition or code isn't provided when an untrapped error occurs) Clearly, I'm missing something!
As always, help or informative redirects muchly appreciated!
pgsql-novice by date
|Next:||From: Tom Lane||Date: 2010-08-16 03:12:02|
|Subject: Re: How to trap invalid enum input exception? |
|Previous:||From: Rikard Bosnjakovic||Date: 2010-08-15 08:19:54|
|Subject: Re: Help with trigger|