> tt=> create table test (a int4, b bit2);
> CREATE
> tt=> CREATE FUNCTION mytrig () RETURNS opaque AS
> '
> tt-> '
> tt'> DECLARE
> tt'> def_state CONSTANT BIT2 := 'b0001'::BIT2;
> tt'> BEGIN
> tt'> new.b = def_state;
> tt'> RETURN new;
> tt'> END;
> tt'> ' LANGUAGE 'plpgsql';
> ERROR: parser: parse error at or near "b0001"
> tt=>
>
Aaaah, Stupidity! I need double quotes around the strings, i.e.
''b0001''....
Sorry for the bandwith.
BTW, is their interest in having a 2 byte bit type as a contributed type
along the lines of int8? I could package it up, and post it. It supports
all the binary operations, i.e. & | ^ ~ << and >>. Only problem I would
like to resolve is why I cannot define the or operator as |.
Adriaan