-
Notifications
You must be signed in to change notification settings - Fork 3
Description
test.out is like this:
create table bit_op (
b0 bit(8), b1 bit(8), band bit(8), bor bit(8),
bxor bit(8), bnot0 bit(8), bnot1 bit(8)
);
create function bt(integer, integer) returns bit_op as '
b0 = BitString.new(args[0], 8)
b1 = BitString.new(args[1], 8)
[b0, b1, b0 & b1, b0 | b1, b0 ^ b1, ~b0, ~b1]
' language 'plruby';
select * from bt(12, 24);
b0 | b1 | band | bor | bxor | bnot0 | bnot1
----------+----------+----------+----------+----------+----------+----------
00001100 | 00011000 | 00001000 | 00011100 | 00010100 | 11110011 | 11100111
(1 row)
select * from bt(12, 32);
b0 | b1 | band | bor | bxor | bnot0 | bnot1
----------+----------+----------+----------+----------+----------+----------
00001100 | 00100000 | 00000000 | 00101100 | 00101100 | 11110011 | 11011111
(1 row)
select * from bt(15, 278);
b0 | b1 | band | bor | bxor | bnot0 | bnot1
----------+----------+----------+----------+----------+----------+----------
00001111 | 00010110 | 00000110 | 00011111 | 00011001 | 11110000 | 11101001
(1 row)
create function be(integer) returns setof integer as '
BitString.new(args[0], 8).each {|i| yield i}
' language 'plruby';
select * from be(12);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
connection to server was lost