Re: Bit string help, please - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Bit string help, please
Date
Msg-id 47CFA7B7.9080902@archonet.com
Whole thread Raw
In response to Bit string help, please  (tyrrill_ed@emc.com)
Responses Re: Bit string help, please  (tyrrill_ed@emc.com)
List pgsql-sql
tyrrill_ed@emc.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


pgsql-sql by date:

Previous
From: "Yura Gal"
Date:
Subject: RETURN QUERY generates error
Next
From: Richard Huxton
Date:
Subject: Re: RETURN QUERY generates error