Re: POC: converting Lists into arrays

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: POC: converting Lists into arrays
Дата
Msg-id 20190722172932.GA25586@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: POC: converting Lists into arrays  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: POC: converting Lists into arrays  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2019-Jul-22, Tom Lane wrote:

> David Rowley <david.rowley@2ndquadrant.com> writes:

> > If we do end up with another function, it might be nice to stay away
> > from using "concat" in the name. I think we might struggle if there
> > are too many variations on concat and there's a risk we'll use the
> > wrong one.  If we need this then perhaps something like
> > list_append_all() might be a better choice... I'm struggling to build
> > a strong opinion on this though. (I know that because I've deleted
> > this paragraph 3 times and started again, each time with a different
> > opinion.)
> 
> Yeah, the name is really the sticking point here; if we could think
> of a name that was easy to understand then the whole thing would be
> much easier to accept.  The best I've been able to come up with is
> "list_join", by analogy to bms_join for bitmapsets ... but that's
> not great.

So with this patch we end up with:

list_union (copies list1, appends list2 element not already in list1)
list_concat_unique (appends list2 elements not already in list)
list_concat (appends all list2 elements)
list_concat_copy (copies list1, appends all list2 elements)

This seems a little random -- for example we end up with "union" being
the same as "concat_copy" except for the copy; and the analogy between
those two seems to exactly correspond to that between "concat_unique"
and "concat".  I would propose to use the name list_union, with flags
being "unique" (or "uniquify" if that's a word, or even just "all" which
seems obvious to people with a SQL background), and something that
suggests "copy_first".

Maybe we can offer a single name that does the four things, selecting
the exact semantics with boolean flags?  (We can provide the old names
as macros, to avoid unnecessarily breaking other code).  Also, perhaps
it would make sense to put them all closer in the source file.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jesper Pedersen
Дата:
Сообщение: Re: pg_receivewal documentation
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Psql patch to show access methods info