Re: I: TODO: Allow substring/replace() to get/set bit values

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Leonardo F <m_lists(at)yahoo(dot)it>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: I: TODO: Allow substring/replace() to get/set bit values
Date: 2010-01-05 16:06:20
Message-ID: 603c8f071001050806t1fc7a522sa4d2442079605eb6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 5, 2010 at 10:45 AM, Leonardo F <m_lists(at)yahoo(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2010-01-05 16:06:49 Re: pg_migrator issues
Previous Message Alvaro Herrera 2010-01-05 16:04:08 Re: We no longer have a fallback for machines without working int64