Allow leading and trailing whitespace in the input to the boolean

type. Also, add explicit casts between boolean and text/varchar. Both
of these changes are for conformance with SQL:2003.

Update the regression tests, bump the catversion.
This commit is contained in:
Neil Conway
2007-06-01 23:40:19 +00:00
parent bd0a260928
commit f086be3d39
8 changed files with 109 additions and 21 deletions

View File

@ -14,7 +14,7 @@ SELECT 1 AS one;
SELECT bool 't' AS true;
SELECT bool 'f' AS false;
SELECT bool ' f ' AS false;
SELECT bool 't' or bool 'f' AS true;
@ -26,6 +26,14 @@ SELECT bool 't' = bool 'f' AS false;
SELECT bool 't' <> bool 'f' AS true;
-- explicit casts to/from text
SELECT 'TrUe'::text::boolean AS true, 'fAlse'::text::boolean AS false;
SELECT ' true '::text::boolean AS true,
' FALSE'::text::boolean AS false;
SELECT true::boolean::text AS true, false::boolean::text AS false;
SELECT ' tru e '::text::boolean AS invalid; -- error
SELECT ''::text::boolean AS invalid; -- error
CREATE TABLE BOOLTBL1 (f1 bool);