From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jan Wieck <JanWieck(at)Yahoo(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: [HACKERS] plpgsql doesn't coerce boolean expressions to boolean |
Date: | 2003-09-09 17:32:09 |
Message-ID: | 3559.1063128729@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
Jan Wieck <JanWieck(at)Yahoo(dot)com> writes:
> ERROR is the cleanest way, but I'd vote for conversion to boolean to
> keep the damage within reason.
Which style of conversion did you like? These were the choices:
>> 3. Try to convert nonbooleans to boolean using plpgsql's usual method
>> for cross-type coercion, ie run the type's output proc to get a
>> string and feed it to bool's input proc. (This seems unlikely to
>> avoid throwing an error in very many cases, but it'd be the most
>> consistent with other parts of plpgsql.)
>>
>> 4. Use the parser's coerce_to_boolean procedure, so that nonbooleans
>> will be accepted in exactly the same cases where they'd be accepted
>> in a boolean-requiring SQL construct (such as CASE). (By default,
>> none are, so this isn't really different from #2. But people could
>> create casts to boolean to override this behavior in a controlled
>> fashion.)
At this point I'm kinda leaning to #4, because (for example) people
could create a cast from integer to boolean to avoid having to fix their
plpgsql functions right away. #3 would not offer any configurability of
behavior.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2003-09-09 17:51:11 | Re: plpgsql doesn't coerce boolean expressions to boolean |
Previous Message | Jan Wieck | 2003-09-09 17:14:05 | Re: [HACKERS] plpgsql doesn't coerce boolean expressions to boolean |
From | Date | Subject | |
---|---|---|---|
Next Message | floyds | 2003-09-09 17:45:24 | contrib/ltree |
Previous Message | Jan Wieck | 2003-09-09 17:14:05 | Re: [HACKERS] plpgsql doesn't coerce boolean expressions to boolean |