Re: [SQL] plpgsql doesn't coerce boolean expressions to

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
Subject: Re: [SQL] plpgsql doesn't coerce boolean expressions to
Date: 2003-09-30 22:26:52
Message-ID: 23397.1064960812@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

I said:
> If we want to preserve this behavior for IF et al, I don't think there
> is any practical way to apply SQL-level type coercion as I had wanted.
> We could instead make the code act like it's assigning to a plpgsql
> boolean variable --- but it will apply plpgsql's textual conversion
> methods, not SQL type coercion.

I have now written and tested the patch for this --- it's doing what I
originally called option 3:

>>> 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.)

Unless someone objects, I'll commit this.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2003-09-30 22:45:45 Re: invalid tid errors in latest 7.3.4 stable.
Previous Message Robert Treat 2003-09-30 20:35:58 Re: expanding on syslog help

Browse pgsql-sql by date

  From Date Subject
Next Message George A.J 2003-10-01 03:17:40 Re: Temporary tables
Previous Message Suresh Basandra 2003-09-30 17:17:42 Re: insert error