Re: linked list rewrite

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: linked list rewrite
Date: 2004-04-28 02:07:00
Message-ID: 21900.1083118020@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Neil Conway <neilc(at)samurai(dot)com> writes:
> Most of your suggestions are agreeable; a few minor quibbles follow.

>> lfirstcell new function to get first cell, or NULL if none
> [...]
>> llastnode llastcell

> What do you think of list_head() and list_tail() instead?

No strong objection, though I thought it was a good idea to include
"cell" in the function names to suggest that what you are getting back
is just a cell and not a List. Anyone else have a preference?

>> set_union list_union
>> set_ptrUnion list_union_ptr
>> list_union_int not currently used
>> set_uniono list_union_oid

> I don't see the need for anything more than set_difference() and
> set_difference_ptr() -- if we're passed a T_IntList or a T_OidList, we
> can examine the list tag and do the Right Thing automagically.

Well, we could, but AFAIK there are no situations where the caller
doesn't know exactly what he wants, and so a switch in the function body
is just a waste of cycles. It is probable that these functions are slow
enough and seldom-used enough that the extra switch doesn't matter much,
so that argument may not have much force. I guess the real question in
my mind is whether there is any true gain in symmetry or readability by
doing it this way. The other functions such as the cons family *will*
need to have the three variants, and so I question that it makes sense
to make these different. Also the need for the _ptr variant makes it a
bit asymmetric even just when looking at these functions.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brent Wood 2004-04-28 02:15:45 help building datetime from varchars
Previous Message Brian Hirt 2004-04-27 23:17:18 locking question

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Browne 2004-04-28 02:24:03 Re: What can we learn from MySQL?
Previous Message Christopher Kings-Lynne 2004-04-28 01:28:26 Re: Usability, MySQL, Postgresql.org, gborg, contrib,