From: Richard Huxton <dev@archonet.com>
To: sneumann <sneumann@ipb-halle.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: PL/pgsql declaration of string / bit / number with given (variable!) length
Date: Tue, 06 Feb 2007 09:45:11 +0000
Message-ID: <45C84E27.2070406@archonet.com> (raw)
In-Reply-To: <1170691341.14733.147.camel@lathan.ipb-sub.ipb-halle.de>
References: <1170691341.14733.147.camel@lathan.ipb-sub.ipb-halle.de>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, sneumann@ipb-halle.de
Subject: Re: PL/pgsql declaration of string / bit / number with given (variable!) length
In-Reply-To: <45C84E27.2070406@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox