From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)info> |
Cc: | pgsql-hackers(at)postgresql(dot)org, Oleg Bartunov <obartunov(at)gmail(dot)com>, Teodor Sigaev <teodor(at)sigaev(dot)ru> |
Subject: | Re: function lca('{}'::ltree[]) caused DB Instance crash |
Date: | 2018-07-13 22:50:33 |
Message-ID: | 29351.1531522233@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-07-13 22:54:12 | Re: [ltree] Should `SELECT LCA('1.2', '1.2.3');` return '1.2' instead of '1'? |
Previous Message | Andrew Dunstan | 2018-07-13 22:16:32 | Re: cannot restore schema with is not distinct from on hstore since PG 9.6.8 |
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2018-07-13 23:25:25 | Re: Generating partitioning tuple conversion maps faster |
Previous Message | Andrew Dunstan | 2018-07-13 22:16:32 | Re: cannot restore schema with is not distinct from on hstore since PG 9.6.8 |