Re: function lca('{}'::ltree[]) caused DB Instance crash

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: function lca('{}'::ltree[]) caused DB Instance crash
Дата
Msg-id 29351.1531522233@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: function lca('{}'::ltree[]) caused DB Instance crash  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I wrote:
> However, I don't understand why this code is returning NULL, rather than
> a zero-length ltree, in the case that there's no common prefix.  That
> doesn't seem consistent to me.

After looking more closely, I see that what lca() returns is the longest
common *ancestor* of the input paths, not the longest common *prefix*
... at least, by my understanding of what a prefix is.  If the longest
prefix is empty, then there's no common ancestor, so returning null in
that case isn't so insane after all.  However, the documentation seems
very misleading on this point.  I changed it around along with pushing
the crash fix.

I wonder whether there isn't a need for an lcp() that would return the
common prefix as that's usually understood.

            regards, tom lane


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: cannot restore schema with is not distinct from on hstore sincePG 9.6.8
Следующее
От: David Rowley
Дата:
Сообщение: Re: Generating partitioning tuple conversion maps faster