https://github.com/adjust/ajbool
triple bool for postgres
https://github.com/adjust/ajbool
adjust-kpis-team adjust-pg-extension
Last synced: 3 months ago
JSON representation
triple bool for postgres
- Host: GitHub
- URL: https://github.com/adjust/ajbool
- Owner: adjust
- Created: 2016-10-17T08:15:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-14T16:43:04.000Z (over 1 year ago)
- Last Synced: 2025-04-16T02:06:28.915Z (about 1 year ago)
- Topics: adjust-kpis-team, adjust-pg-extension
- Language: C
- Homepage:
- Size: 86.9 KB
- Stars: 6
- Watchers: 65
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
[](https://github.com/adjust/ajbool/actions/workflows/main.yml)
# ajbool
A special boolean type that allows 'unknown' state without beeing NULL.
The intent is to allow a triple boolean value that can be used as PRIMARY key.
Expected intput is 't', 'f', 'u' for true, false and unknown.
Note ajbool can still be set to NULL if needed.
## usage
Typecast
```
SELECT true::ajbool, false::ajbool, NULL::bool::ajbool;
ajbool | ajbool | ajbool
--------+--------+--------
t | f | u
(1 row)
SELECT 't'::ajbool::bool, 'f'::ajbool::bool, 'u'::ajbool::bool;
bool | bool | bool
------+------+------
t | f | NULL
```
##Parallelism Support
PostgreSQL 9.6 introduced parallelism safety markings for functions.
The ajbool-00.0.1--0.0.2.sql in the extensions directory makrs these
as safe. You should run this file after upgrading PostgreSQL.