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

2018-07-13 Thread Tom Lane
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

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

2018-07-13 Thread Tom Lane
Pierre Ducroquet writes: > On Friday, July 13, 2018 12:09:20 PM CEST 李海龙 wrote: >> contrib_regression=# select lca('{}'::ltree[]); >> server closed the connection unexpectedly > There is indeed a bug. The _lca function in _ltree_op.c tries to allocate 0 > bytes of memory, doesn't initialize it

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

2018-07-13 Thread Pierre Ducroquet
On Friday, July 13, 2018 12:09:20 PM CEST 李海龙 wrote: > HI,Oleg && pgsql-hackers > > Plese help me to check this is a bug of ltree? > Hi There is indeed a bug. The _lca function in _ltree_op.c tries to allocate 0 bytes of memory, doesn't initialize it and dereference it in lca_inner. The

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

2018-07-13 Thread 李海龙
HI,Oleg && pgsql-hackers Plese help me to check this is a bug of ltree? thxs! lhl@localhost:~$ cat /etc/issue Ubuntu 14.04.5 LTS \n \l lhl@localhost:~$ uname -av Linux localhost 3.13.0-107-generic #154-Ubuntu SMP Tue Dec 20 09:57:27 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux