Monday, November 7, 2011

Postgresql - Bit datatype

I've had never used it before. Quite an interesting datatype
Bit strings are strings of 1's and 0's. They can be used to store or visualize bit masks. There are two SQL bit types: bit(n) and bit varying(n), where n is a positive integer.

bit type data must match the length n exactly; it is an error to attempt to store shorter or longer bit strings. bit varying data is of variable length up to the maximum length n; longer strings will be rejected. Writing bit without a length is equivalent to bit(1), while bit varying without a length specification means unlimited length.

http://www.postgresql.org/docs/8.2/static/datatype-bit.html

http://www.java2s.com/Code/PostgreSQL/Data-Type/UsingBitdatatype.htm

No comments:

Post a Comment