postgresql/contrib/ltree
Tom Lane dbd7f4e7c4 Fix crash in contrib/ltree's lca() function for empty input array.
lca_inner() wasn't prepared for the possibility of getting no inputs.
Fix that, and make some cosmetic improvements to the code while at it.

Also, I thought the documentation of this function as returning the
"longest common prefix" of the paths was entirely misleading; it really
returns a path one shorter than the longest common prefix, for the typical
definition of "prefix".  Don't use that term in the docs, and adjust the
examples to clarify what really happens.

This has been broken since its beginning, so back-patch to all supported
branches.

Per report from Hailong Li.  Thanks to Pierre Ducroquet for diagnosing
and for the initial patch, though I whacked it around some and added
test cases.

Discussion: https://postgr.es/m/5b0d8e4f-f2a3-1305-d612-e00e35a7be66@qunar.com
2018-07-13 18:45:30 -04:00
..
data
expected Fix crash in contrib/ltree's lca() function for empty input array. 2018-07-13 18:45:30 -04:00
sql Fix crash in contrib/ltree's lca() function for empty input array. 2018-07-13 18:45:30 -04:00
_ltree_gist.c Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
_ltree_op.c
.gitignore
crc32.c
crc32.h
lquery_op.c
ltree_gist.c Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
ltree_io.c
ltree_op.c Fix crash in contrib/ltree's lca() function for empty input array. 2018-07-13 18:45:30 -04:00
ltree--1.0--1.1.sql
ltree--1.1.sql
ltree--unpackaged--1.0.sql
ltree.control
ltree.h
ltreetest.sql
ltxtquery_io.c
ltxtquery_op.c
Makefile