BUG #1922: bit string of calculated length

Started by Sorin Schwimmerover 20 years ago2 messagesbugs
Jump to latest
#1Sorin Schwimmer
sxn02@yahoo.com

The following bug has been logged online:

Bug reference: 1922
Logged by: Sorin Schwimmer
Email address: sxn02@yahoo.com
PostgreSQL version: 8.0.2
Operating system: Gentoo Linux 2005
Description: bit string of calculated length
Details:

When puting in an expression something like
'0'::BIT(20-LENGTH(something_here))
I receive an error message suggesting that integer arithmetic is not allowed
in a BIT declaration.
The following experiments should prove my point:
SELECT '0'::BIT(20-4);
SELECT '0'::BIT(10+2);

I'd like to suggest to allow for any expression that converts to positive
integer.

Thanks,
Sorin Schwimmer

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Sorin Schwimmer (#1)
Re: BUG #1922: bit string of calculated length

"Sorin Schwimmer" <sxn02@yahoo.com> writes:

When puting in an expression something like
'0'::BIT(20-LENGTH(something_here))
I receive an error message suggesting that integer arithmetic is not allowed
in a BIT declaration.

Yup, you're right.

I'd like to suggest to allow for any expression that converts to positive
integer.

Don't hold your breath. This is not required by the SQL spec and it
seems much more difficult to implement than it's worth.

regards, tom lane