Re: PL/pgsql declaration of string / bit / number with given (variable!) length

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: PL/pgsql declaration of string / bit / number with given (variable!) length
Дата
Msg-id 45C84E27.2070406@archonet.com
обсуждение исходный текст
Ответ на PL/pgsql declaration of string / bit / number with given (variable!) length  (sneumann <sneumann@ipb-halle.de>)
Список pgsql-sql
sneumann wrote:
> Hi,
> 
> I have a PL/pgsql function that creates a certain bit string
> based on the parameters. Things work fine if I use bit(10)
> throughout the function. Now I'd like to return a bit string 
> with the given size "len", but that breaks with a syntax error:
> 
>         ret := B'0'::bit(len);
>     LINE 1: SELECT  B'0'::bit( $1 )
>                                ^
> 
> Any suggestion how to return a (bit) string 
> of user-defined length ?

Hmm - not sure it's possible (even theoretically) for a function to have 
multiple return types. Could you return a "bit varying" and cast it when 
received?

--   Richard Huxton  Archonet Ltd


В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Compilation errors
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Index ANDing & Index ORing