Thread: TID: <> operator

TID: <> operator

From
Neil Conway
Date:
Attached is a patch that implements <> for the tid type. This is based
on a patch submitted by Mark Kirkwood in October of 2005. I added some
regression tests, avoided unnecessarily renumbering a few OIDs in the
system catalogs, and bumped the catversion.

Barring any objections I'll apply this tomorrow.

-Neil


Attachment

Re: TID: <> operator

From
Neil Conway
Date:
On Sat, 2006-02-25 at 22:00 -0500, Neil Conway wrote:
> Attached is a patch that implements <> for the tid type. This is based
> on a patch submitted by Mark Kirkwood in October of 2005. I added some
> regression tests, avoided unnecessarily renumbering a few OIDs in the
> system catalogs, and bumped the catversion.

Applied.

-Neil



Re: <> operator

From
"Qingqing Zhou"
Date:
"Neil Conway" <neilc@samurai.com> wrote
> Attached is a patch that implements <> for the tid type. This is based
> on a patch submitted by Mark Kirkwood in October of 2005. I added some
> regression tests, avoided unnecessarily renumbering a few OIDs in the
> system catalogs, and bumped the catversion.
>

Does it make sense to implementation > or < for the tid type? I will see it
as a "kinda" alternative for LIMIT clause.

Regards,
Qingqing



Re: <> operator

From
Neil Conway
Date:
On Mon, 2006-02-27 at 11:37 +0800, Qingqing Zhou wrote:
> Does it make sense to implementation > or < for the tid type?

I can't get too excited about it, but I wouldn't object if someone can
see a use for it.

-Neil



Re: <> operator

From
"Qingqing Zhou"
Date:
"Neil Conway" <neilc@samurai.com> wrote
> > Does it make sense to implementation > or < for the tid type?
>
> I can't get too excited about it, but I wouldn't object if someone can
> see a use for it.
>

There might be another usage of tid < or >. Consider a heap with one middle
page is broken, I could save most of my data by doing

INSERT INTO aa SELECT * FROM a WHERE ctid < '(1000, 1)';
INSERT INTO aa SELECT * FROM a WHERE ctid > '(1001, 0)';

The above example also proves that <= or >= is not required.

Regards,
Qingqing



Re: <> operator

From
Tom Lane
Date:
"Qingqing Zhou" <zhouqq@cs.toronto.edu> writes:
> There might be another usage of tid < or >. Consider a heap with one middle
> page is broken, I could save most of my data by doing
> INSERT INTO aa SELECT * FROM a WHERE ctid < '(1000, 1)';
> INSERT INTO aa SELECT * FROM a WHERE ctid > '(1001, 0)';

Well, not really, because the planner won't optimize that, hence will
try to apply the WHERE condition to each row of the table, hence you'll
still bomb on the bad page.

> The above example also proves that <= or >= is not required.

<> is "not required" either since NOT (foo = bar) serves perfectly well.
If we're going to do this I'd vote for putting in all four operators
just to minimize the surprise factor.  But I'm not sold that there's
a use case, any more than Neil is.

            regards, tom lane