Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
12884987
Commit
12884987
authored
Oct 05, 2008
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional test coverage for boolean type (bool.c)
parent
44d5be0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
159 additions
and
2 deletions
+159
-2
src/test/regress/expected/boolean.out
src/test/regress/expected/boolean.out
+114
-1
src/test/regress/sql/boolean.sql
src/test/regress/sql/boolean.sql
+45
-1
No files found.
src/test/regress/expected/boolean.out
View file @
12884987
...
@@ -11,7 +11,19 @@ SELECT 1 AS one;
...
@@ -11,7 +11,19 @@ SELECT 1 AS one;
(1 row)
(1 row)
-- ******************testing built-in type bool********************
-- ******************testing built-in type bool********************
-- check bool type-casting as well as and, or, not in qualifications--
-- check bool input syntax
SELECT true AS true;
true
------
t
(1 row)
SELECT false AS false;
false
-------
f
(1 row)
SELECT bool 't' AS true;
SELECT bool 't' AS true;
true
true
------
------
...
@@ -24,6 +36,83 @@ SELECT bool ' f ' AS false;
...
@@ -24,6 +36,83 @@ SELECT bool ' f ' AS false;
f
f
(1 row)
(1 row)
SELECT bool 'true' AS true;
true
------
t
(1 row)
SELECT bool 'test' AS error;
ERROR: invalid input syntax for type boolean: "test"
LINE 1: SELECT bool 'test' AS error;
^
SELECT bool 'false' AS false;
false
-------
f
(1 row)
SELECT bool 'foo' AS error;
ERROR: invalid input syntax for type boolean: "foo"
LINE 1: SELECT bool 'foo' AS error;
^
SELECT bool 'y' AS true;
true
------
t
(1 row)
SELECT bool 'yes' AS true;
true
------
t
(1 row)
SELECT bool 'yeah' AS error;
ERROR: invalid input syntax for type boolean: "yeah"
LINE 1: SELECT bool 'yeah' AS error;
^
SELECT bool 'n' AS false;
false
-------
f
(1 row)
SELECT bool 'no' AS false;
false
-------
f
(1 row)
SELECT bool 'nay' AS error;
ERROR: invalid input syntax for type boolean: "nay"
LINE 1: SELECT bool 'nay' AS error;
^
SELECT bool '1' AS true;
true
------
t
(1 row)
SELECT bool '11' AS error;
ERROR: invalid input syntax for type boolean: "11"
LINE 1: SELECT bool '11' AS error;
^
SELECT bool '0' AS false;
false
-------
f
(1 row)
SELECT bool '000' AS error;
ERROR: invalid input syntax for type boolean: "000"
LINE 1: SELECT bool '000' AS error;
^
SELECT bool '' AS error;
ERROR: invalid input syntax for type boolean: ""
LINE 1: SELECT bool '' AS error;
^
-- and, or, not in qualifications
SELECT bool 't' or bool 'f' AS true;
SELECT bool 't' or bool 'f' AS true;
true
true
------
------
...
@@ -54,6 +143,30 @@ SELECT bool 't' <> bool 'f' AS true;
...
@@ -54,6 +143,30 @@ SELECT bool 't' <> bool 'f' AS true;
t
t
(1 row)
(1 row)
SELECT bool 't' > bool 'f' AS true;
true
------
t
(1 row)
SELECT bool 't' >= bool 'f' AS true;
true
------
t
(1 row)
SELECT bool 'f' < bool 't' AS true;
true
------
t
(1 row)
SELECT bool 'f' <= bool 't' AS true;
true
------
t
(1 row)
-- explicit casts to/from text
-- 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;
true | false
true | false
...
...
src/test/regress/sql/boolean.sql
View file @
12884987
...
@@ -10,12 +10,48 @@ SELECT 1 AS one;
...
@@ -10,12 +10,48 @@ SELECT 1 AS one;
-- ******************testing built-in type bool********************
-- ******************testing built-in type bool********************
-- check bool type-casting as well as and, or, not in qualifications--
-- check bool input syntax
SELECT
true
AS
true
;
SELECT
false
AS
false
;
SELECT
bool
't'
AS
true
;
SELECT
bool
't'
AS
true
;
SELECT
bool
' f '
AS
false
;
SELECT
bool
' f '
AS
false
;
SELECT
bool
'true'
AS
true
;
SELECT
bool
'test'
AS
error
;
SELECT
bool
'false'
AS
false
;
SELECT
bool
'foo'
AS
error
;
SELECT
bool
'y'
AS
true
;
SELECT
bool
'yes'
AS
true
;
SELECT
bool
'yeah'
AS
error
;
SELECT
bool
'n'
AS
false
;
SELECT
bool
'no'
AS
false
;
SELECT
bool
'nay'
AS
error
;
SELECT
bool
'1'
AS
true
;
SELECT
bool
'11'
AS
error
;
SELECT
bool
'0'
AS
false
;
SELECT
bool
'000'
AS
error
;
SELECT
bool
''
AS
error
;
-- and, or, not in qualifications
SELECT
bool
't'
or
bool
'f'
AS
true
;
SELECT
bool
't'
or
bool
'f'
AS
true
;
SELECT
bool
't'
and
bool
'f'
AS
false
;
SELECT
bool
't'
and
bool
'f'
AS
false
;
...
@@ -26,6 +62,14 @@ SELECT bool 't' = bool 'f' AS false;
...
@@ -26,6 +62,14 @@ SELECT bool 't' = bool 'f' AS false;
SELECT
bool
't'
<>
bool
'f'
AS
true
;
SELECT
bool
't'
<>
bool
'f'
AS
true
;
SELECT
bool
't'
>
bool
'f'
AS
true
;
SELECT
bool
't'
>=
bool
'f'
AS
true
;
SELECT
bool
'f'
<
bool
't'
AS
true
;
SELECT
bool
'f'
<=
bool
't'
AS
true
;
-- explicit casts to/from text
-- 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 '
::
text
::
boolean
AS
true
,
SELECT
' true '
::
text
::
boolean
AS
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment