OT postgres: bitwise testing & setting?
this is way OT, but debian-user has the Folks Who Know...
i'm using 6.3 postgresql on potato, and would like to compress
a wee bit-o-space out of each record by using bitwise booleans,
instead of bytewise.
there seems to be no bitwise operators to facilitate such
testing (nor even an numerative dataset type) so i was trying
CREATE TABLE
mytable
(
-- otherfields
flags int2
-- otherfields
);
CREATE VIEW
myflags
AS
SELECT
-- otherfields, yada yada
((flags % 2) / 1) = 1 as first,
((flags % 4) / 2) = 1 as second,
((flags % 8) / 4) = 1 as third
FROM
mytable
;
which works to a point ... but when you try to establish all
16 bits (using < 0 for -32768 :) i gripes about
ERROR: DefineQueryRewrite: rule plan string too big.
what are the alternatives? create function? [care to give a gentle intro?]
and this is just for bitwise TESTING. i haven't even GOT to the
'bitwise SETTING' part yet...!
--
There are only two places in the world where time takes
precedence over the job to be done. School and prison.
--William Glasser
three: union labor. -- will trillich
will@serensoft.com *** http://www.dontUthink.com/
volunteer to document your experience for next week's
newbies -- http://www.eGroups.com/messages/newbieDoc
Reply to: