1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00
here is an updated version of the bit type with a bugfix and all the necessa
ry
SQL functions defined. This should replace what is currently in contrib. I'd
appreciate any comments on what is there.

Kind regards,

Adriaan
This commit is contained in:
Bruce Momjian
2000-04-03 20:56:40 +00:00
parent 5454b37921
commit 51cfdae50f
10 changed files with 423 additions and 132 deletions

View File

@ -0,0 +1,29 @@
create table bit_example (a bits, b bits);
copy bit_example from stdin;
X0F X10
X1F X11
X2F X12
X3F X13
X8F X04
X000F X0010
X0123 XFFFF
X2468 X2468
XFA50 X05AF
X12345 XFFF
\.
select a,b,a||b as "a||b", bitsubstr(a,4,4) as "sub(a,4,4)",
bitsubstr(b,2,4) as "sub(b,2,4)",
bitsubstr(b,5,5) as "sub(b,5,5)"
from bit_example;
select a,b,~a as "~ a",~b as "~ b",a & b as "a & b",
a|b as "a | b", a^b as "a ^ b" from bit_example;
select a,b,a<b as "a<b",a<=b as "a<=b",a=b as "a=b",
a>=b as "a>=b",a>b as "a>b",a<=>b as "a<=>b" from bit_example;
select a,a<<4 as "a<<4",b,b>>2 as "b>>2" from bit_example;
select a,b,a||b as "a||b", bitsubstr(a,4,4) as "sub(a,4,4)",
bitsubstr(b,2,4) as "sub(b,2,4)",
bitsubstr(b,5,5) as "sub(b,5,5)"
from bit_example;
drop table bit_example;