Re: Bit string help, please
От | tyrrill_ed@emc.com |
---|---|
Тема | Re: Bit string help, please |
Дата | |
Msg-id | 4FB0C599D8D0B14FA37B46EAD92F2153036EF2A2@CORPUSMX60C.corp.emc.com обсуждение исходный текст |
Ответ на | Re: Bit string help, please (Richard Huxton <dev@archonet.com>) |
Ответы |
Re: Bit string help, please
|
Список | pgsql-sql |
I tried this real quick at the psql command prompt, and unfortunately it doesn't work: mydb=# select ('1' || repeat('0',7))::bit varying; ERROR: cannot cast type text to bit varying I appreciate the try though. Any other ideas? I am using PostgreSQL 8.2.3.1. I don't know if that matters too much. Thanks, Ed -----Original Message----- From: Richard Huxton [mailto:dev@archonet.com] Sent: Thursday, March 06, 2008 12:14 AM To: Tyrrill, Ed Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Bit string help, please 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 по дате отправления: