d2rq/d2rq — Issue #117: Handling of BIT datatype
Author: cygri
Created: 2012-03-09 02:48:40+00:00
State: open
Labels: compatibility, conformance

The `BIT` datatypes (bit strings, e.g., `BIT`, `BIT(n)` and `BIT VARYING`) are currently mapped to plain literals consisting of 0's and 1's rather than to an appropriate XSD type. Unfortunately, there is nothing in XSD that quite matches:

* `xsd:boolean` could work for `BIT(1)` but for nothing else
* `xsd:hexBinary` or `xsd:base64Binary` don't capture the length of the bit string, as they can only handle octets of bits
* `xsd:integer` would not capture the length of the bit string, as `0000` and `0` are different `BIT VARYING` values but both would map to integer 0
* A custom datatype would be imaginable, but those are not popular

Is there a better alternative to plain literals for `BIT` and friends?