next draft of list rewrite - Mailing list pgsql-patches

From Neil Conway
Subject next draft of list rewrite
Date
Msg-id 87r7xoad4k.fsf@mailbox.samurai.com
Whole thread Raw
Responses Re: next draft of list rewrite  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
I've attached the latest header and implementation files (pg_list.h
and list.c, respectively) for the new linked list implementation. I'm
pretty satisfied with the new API: now would be the ideal time to
suggest any changes you think I should make to it. I decided to use a
new naming convention: all public functions and macros are prefixed
with list_ or cell_, as appropriate, and type-specific functions are
suffixed with _int or _oid, as appropriate.

ISTM that the "allocate the list itself and the head node in one
palloc()" idea that Tom suggested actually won't work: since the head
node can change over the life of the list, we need to be able to
deallocate a list cell via pfree() -- which would not be the case if a
particular node was allocated via the same palloc() as the list
itself.

BTW, one nice thing about the new List API is that it lets us get rid
of the WRITE_INTLIST_FIELD() and related cruft in nodes/, because each
type of list (T_List, T_IntList, or T_OidList) is now a legitimate
Node in its own right. So we can now use WRITE_NODE_FIELD() to output
a list of integers, for example.

(The implementation is a little "off the cuff", and I haven't reviewed
it; also, since the tree is totally broken with this patch applied, I
haven't tested it either. That said, I'd appreciate anyone mentioning
any implementation bugs they might happen to spot.)

Incidentally, does anyone have any thoughts on the best way to commit
this? It requires changing pretty much _every single_ place in the
code that uses the List API. Although most of those modifications
should be trivial, it will still require touching a lot of
files. Should I just make the changes locally and commit them all in
one fell swoop? Create a private branch in CVS? Any other suggestions?

FWIW, I'm hoping to have this done (and committed to CVS HEAD) by the
end of next weekend.

-Neil


Attachment

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: appendStringInfoString() micro-opt
Next
From: Kris Jurka
Date:
Subject: contrib/ltree Readme operator name