Re: I: TODO: Allow substring/replace() to get/set bit values - Mailing list pgsql-hackers

From Robert Haas
Subject Re: I: TODO: Allow substring/replace() to get/set bit values
Date
Msg-id 603c8f071001050806t1fc7a522sa4d2442079605eb6@mail.gmail.com
Whole thread Raw
In response to Re: I: TODO: Allow substring/replace() to get/set bit values  (Leonardo F <m_lists@yahoo.it>)
Responses Re: I: TODO: Allow substring/replace() to get/set bit values
List pgsql-hackers
On Tue, Jan 5, 2010 at 10:45 AM, Leonardo F <m_lists@yahoo.it> wrote:
>> As you say, there's really no point in changing the internal
>> representation, and if you don't find replace() useful either, then
>> why are you even working on this at all?
>
> I would like a get_bit / set_bit for bit strings, as I find them useful.
> get_bit could be a simple call to substring, but there's no way of doing a set_bit on a bit string as far as I know.
>
> I don't like the "replace" syntax for bit strings since it won't give you the same functionality of set_bit,
> plus I don't really see how someone would want to look for a bit string and replace it with another bit string.
> But I see that someone might want to overlay a bit string with another (this is different from "replace" since you
> have to tell the position where the replacing would start, instead of looking for a bit string).
>
> To sum up:
>
> 1) a new function, "get_bit", that calls substring
> 2) a new function, "overlay", that replaces bits (starting at a certain position)
> 3) a new function, "set_bit", that calls overlay

That seems reasonable to me.  Not sure what others think.

>> Since the latest discussion
>> of this is more than five years old, it's unclear that anyone even
>> cares any more.  It seems to me that making replace overlay a
>> substring of bits could be a reasonable thing to do, but if nobody
>> actually wants it, then the simplest thing to do is remove this from
>> the TODO and call it good.
>
> I understand: it would be both a useful feature to me and a way to start coding postgres.
>
> But, of course, if there's no interest, I'll pass...

I wouldn't jump to that conclusion.  I just wasn't sure what you were
trying to do, but it's more clear now.

...Robert


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: We no longer have a fallback for machines without working int64
Next
From: Alvaro Herrera
Date:
Subject: Re: pg_migrator issues