mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-26 16:27:02 +08:00
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:
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user