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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to