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

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

> 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

> 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...

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-01-05 15:47:33 We no longer have a fallback for machines without working int64
Previous Message Tom Lane 2010-01-05 15:38:41 Re: Does parallel make require guards against duplicate actions?