diff options
| author | Neil Conway | 2007-06-01 23:40:19 +0000 |
|---|---|---|
| committer | Neil Conway | 2007-06-01 23:40:19 +0000 |
| commit | f086be3d39ce003532ce818347354fe8d6efe8eb (patch) | |
| tree | 5e1c727cf92b4c410b2a75a54663acf6a5bb90cf /src/test | |
| parent | bd0a260928971feec484a22f0b86e5d1936c974f (diff) | |
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.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/boolean.out | 26 | ||||
| -rw-r--r-- | src/test/regress/sql/boolean.sql | 10 |
2 files changed, 34 insertions, 2 deletions
diff --git a/src/test/regress/expected/boolean.out b/src/test/regress/expected/boolean.out index 93e475b673f..511987e8b9b 100644 --- a/src/test/regress/expected/boolean.out +++ b/src/test/regress/expected/boolean.out @@ -18,7 +18,7 @@ SELECT bool 't' AS true; t (1 row) -SELECT bool 'f' AS false; +SELECT bool ' f ' AS false; false ------- f @@ -54,6 +54,30 @@ SELECT bool 't' <> bool 'f' AS true; t (1 row) +-- explicit casts to/from text +SELECT 'TrUe'::text::boolean AS true, 'fAlse'::text::boolean AS false; + true | false +------+------- + t | f +(1 row) + +SELECT ' true '::text::boolean AS true, + ' FALSE'::text::boolean AS false; + true | false +------+------- + t | f +(1 row) + +SELECT true::boolean::text AS true, false::boolean::text AS false; + true | false +------+------- + true | false +(1 row) + +SELECT ' tru e '::text::boolean AS invalid; -- error +ERROR: invalid input syntax for type boolean: " tru e " +SELECT ''::text::boolean AS invalid; -- error +ERROR: invalid input syntax for type boolean: "" CREATE TABLE BOOLTBL1 (f1 bool); INSERT INTO BOOLTBL1 (f1) VALUES (bool 't'); INSERT INTO BOOLTBL1 (f1) VALUES (bool 'True'); diff --git a/src/test/regress/sql/boolean.sql b/src/test/regress/sql/boolean.sql index df97dfab3b3..c68f02e7a5a 100644 --- a/src/test/regress/sql/boolean.sql +++ b/src/test/regress/sql/boolean.sql @@ -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); |
