binary operators on integers

Started by Marko Kreenover 25 years ago4 messagesgeneral
Jump to latest
#1Marko Kreen
markokr@gmail.com

I want to do simple and/or/xor/test operations on integers
but PostgreSQL seems not to support this. I found in conrib
area the 'bit' package, which supports 'SQL-compliant bitstrings'
but this is too weird for me and anyway it crashes too.

So, my question 'How can I do this?' Is there any plans to implement
those operators for integer types, or good reasons why they cannot
be implemented? Should I try to implement those myself or start
debugging the 'bit' package?

My situation: I want to implement a 'capabilities' field for
application server, so different bits are for different
capabilities.

TIA.

--
marko

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Marko Kreen (#1)
Re: binary operators on integers

Marko Kreen writes:

I want to do simple and/or/xor/test operations on integers
but PostgreSQL seems not to support this. I found in conrib
area the 'bit' package, which supports 'SQL-compliant bitstrings'
but this is too weird for me and anyway it crashes too.

These were the remainders of a slightly too late implementation attempt
for 7.0. In 7.1 they should be fully functional.

My situation: I want to implement a 'capabilities' field for
application server, so different bits are for different
capabilities.

Personally, I'd say using bit fields for that is pushing it a little too
hard. You could use shortint fields, or char(1)'s if you are not that
concerned about space.

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/

#3Marko Kreen
markokr@gmail.com
In reply to: Peter Eisentraut (#2)
Re: binary operators on integers

On Mon, Sep 18, 2000 at 10:17:55PM +0200, Peter Eisentraut wrote:

Marko Kreen writes:

My situation: I want to implement a 'capabilities' field for
application server, so different bits are for different
capabilities.

Personally, I'd say using bit fields for that is pushing it a little too
hard. You could use shortint fields, or char(1)'s if you are not that
concerned about space.

Hmm, probably you are right.

But now I am only curious: Will PostgreSQL support binary
arithmetics on ordinary integers someday or is the 'bit-string'
only way to go?

--
marko

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Marko Kreen (#3)
Re: binary operators on integers

Marko Kreen writes:

But now I am only curious: Will PostgreSQL support binary
arithmetics on ordinary integers someday or is the 'bit-string'
only way to go?

AFAIK, there's no one working on the former. Feel free to contribute. :-)

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/