TID: <> operator

Started by Neil Conwayover 20 years ago6 messagespatches
Jump to latest
#1Neil Conway
neilc@samurai.com

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

Attachments:

tid_ne-1.patchtext/x-patch; charset=us-ascii; name=tid_ne-1.patchDownload+37-4
#2Neil Conway
neilc@samurai.com
In reply to: Neil Conway (#1)
Re: TID: <> operator

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

#3Qingqing Zhou
zhouqq@cs.toronto.edu
In reply to: Neil Conway (#1)
Re: <> operator

"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

#4Neil Conway
neilc@samurai.com
In reply to: Qingqing Zhou (#3)
Re: <> operator

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

#5Qingqing Zhou
zhouqq@cs.toronto.edu
In reply to: Neil Conway (#1)
Re: <> operator

"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

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Qingqing Zhou (#5)
Re: <> operator

"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