tyrrill_ed(at)emc(dot)com wrote:
>
> insert into table1 values( DEFAULT, B'1'::bit( n ) );
>
> Where n is one of the parameters to the PL/pgSQL function, but that
> doesn't work. PostgreSQL doesn't like having a variable for the bit
> string length. Does anyone have any ideas how I could achieve this?
Try casting from a string:
SELECT ('1' || repeat('0', n-1))::bit varying;
--
Richard Huxton
Archonet Ltd