Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: introduce type <Boolean> #3648

Closed
Korablev77 opened this issue Aug 28, 2018 · 3 comments
Closed

sql: introduce type <Boolean> #3648

Korablev77 opened this issue Aug 28, 2018 · 3 comments
Assignees
Labels
Milestone

Comments

@Korablev77
Copy link
Contributor

Originally, SQLite lacks type <Boolean>. Instead, it uses simple <1> and <0>. To support ANSI we should introduce separate <Boolean> type.
<Boolean> specification from ANSI:

The data type boolean comprises the distinct truth values True and False. Unless prohibited by a NOT NULL constraint, the boolean data type also supports the truth value Unknown as the null value. This specification does not make a distinction between the null value of the boolean data type and the truth value Unknown that is the result of an SQL <predicate>, <search condition>, or <boolean value expression>; they may be used interchangeably to mean exactly the same thing.
The boolean data type is described by the boolean data type descriptor. The boolean data type descriptor contains: — The name of the boolean data type (BOOLEAN).

All boolean values and SQL truth values are comparable and all are assignable to a site of type boolean. The value True is greater than the value False, and any comparison involving the null value or an Unknown truth value will return an Unknown result. The values True and False may be assigned to any site having a boolean data type; assignment of Unknown, or the null value, is subject to the nullability characteristic of the target.

@Korablev77 Korablev77 self-assigned this Aug 28, 2018
@kyukhin kyukhin added this to the 2.2.0 milestone Sep 6, 2018
@Korablev77
Copy link
Contributor Author

Korablev77 commented Sep 16, 2018

After this type is introduced, we may force some conversions. For instance, most DBs require arguments of predicates be of type boolean (now they can be INT). For instance, 123 OR 0 is not allowed, but 123 != 0 OR false is OK.

4.5.3.2 Other operators involving booleans
Every SQL <predicate>, <search condition>, and <boolean value expression> may be considered as an operator that returns a boolean result.

@Korablev77
Copy link
Contributor Author

Korablev77 commented Oct 8, 2018

Last proposal is considered to be self-sufficient and moved to separate issue: #3723

@kyukhin kyukhin added the prio1 label Apr 8, 2019
Korablev77 added a commit that referenced this issue Apr 13, 2019
This patch introduces basic facilities to operate on boolean type:
boolean literals "true" and "false" where true > false; alias to null -
unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
insert and select boolean values from table; OR and AND predicates
accept boolean arguments; CAST operation involving boolean type;
comparison between boolean values (including VDBE sorter routines).

Part of #3648
Korablev77 added a commit that referenced this issue Apr 14, 2019
This patch introduces basic facilities to operate on boolean type:
boolean literals "true" and "false" where true > false; alias to null -
unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
insert and select boolean values from table; OR and AND predicates
accept boolean arguments; CAST operation involving boolean type;
comparison between boolean values (including VDBE sorter routines).

Part of #3648
@kyukhin kyukhin added the sql label Apr 16, 2019
Korablev77 added a commit that referenced this issue Apr 18, 2019
This patch introduces basic facilities to operate on boolean type:
boolean literals "true" and "false" where true > false; alias to null -
unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
insert and select boolean values from table; OR and AND predicates
accept boolean arguments; CAST operation involving boolean type;
comparison between boolean values (including VDBE sorter routines).

Part of #3648
Gerold103 pushed a commit that referenced this issue Apr 22, 2019
This patch introduces basic facilities to operate on boolean type:
boolean literals "true" and "false" where true > false; alias to null -
unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
insert and select boolean values from table; OR and AND predicates
accept boolean arguments; CAST operation involving boolean type;
comparison between boolean values (including VDBE sorter routines).

Part of #3648
Korablev77 added a commit that referenced this issue Apr 23, 2019
This patch introduces basic facilities to operate on boolean type:
boolean literals "true" and "false" where true > false; alias to null -
unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
insert and select boolean values from table; OR and AND predicates
accept boolean arguments; CAST operation involving boolean type;
comparison between boolean values (including VDBE sorter routines).

Part of #3648
Korablev77 added a commit that referenced this issue Apr 23, 2019
This patch introduces basic facilities to operate on boolean type:
boolean literals "true" and "false" where true > false; alias to null -
unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
insert and select boolean values from table; OR and AND predicates
accept boolean arguments; CAST operation involving boolean type;
comparison between boolean values (including VDBE sorter routines).

Part of #3648
Korablev77 added a commit that referenced this issue Apr 24, 2019
This patch introduces basic facilities to operate on boolean type:
boolean literals "true" and "false" where true > false; alias to null -
unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
insert and select boolean values from table; OR and AND predicates
accept boolean arguments; CAST operation involving boolean type;
comparison between boolean values (including VDBE sorter routines).

Part of #3648
kshcherbatov pushed a commit that referenced this issue Apr 24, 2019
This patch introduces basic facilities to operate on boolean type:
boolean literals "true" and "false" where true > false; alias to null -
unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
insert and select boolean values from table; OR and AND predicates
accept boolean arguments; CAST operation involving boolean type;
comparison between boolean values (including VDBE sorter routines).

Part of #3648
kyukhin pushed a commit that referenced this issue Apr 25, 2019
This patch introduces basic facilities to operate on boolean type:
boolean literals "true" and "false" where true > false; alias to null -
unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
insert and select boolean values from table; OR and AND predicates
accept boolean arguments; CAST operation involving boolean type;
comparison between boolean values (including VDBE sorter routines).

Part of #3648
@Korablev77
Copy link
Contributor Author

Closed in 0a8b179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants