[ltree] Should `SELECT LCA('1.2', '1.2.3');` return '1.2' instead of '1'?

From: Julien Grillot <julien(dot)grillot(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: [ltree] Should `SELECT LCA('1.2', '1.2.3');` return '1.2' instead of '1'?
Date: 2017-12-01 15:32:59
Message-ID: CAKnjZ0KTVw63SM5wkWqAkNRv5+-GPXF8r60vtssvhOWJ3N5otA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Operating system: Ubuntu 17.04
PostgreSQL version: 9.6.6

At the moment, both SELECT LCA('1.2', '1.2'); and SELECT LCA('1.2',
'1.2.3'); return ‘1’.

According to the Wikipedia1 definition of LCA:
“[…] the lowest common ancestor (LCA) of two nodes v and w […] is the
lowest (i.e. deepest) node that has both v and w as descendants, where we
define each node to be a descendant of itself (so if v has a direct
connection from w, w is the lowest common ancestor).”

So, in my understanding, both SELECT LCA('1.2', '1.2'); and SELECT
LCA('1.2', '1.2.3'); should return ‘1.2’. What do you think about it?

By the way, the ltree structure is really great, thank you!

Julien Grillot

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message lyes.amd 2017-12-01 16:09:07 BUG #14941: Vacuum crashes
Previous Message Сергей А. Фролов 2017-12-01 15:19:29 Re: BUG #14940: Duplicated records inspite of primary key and unique constraint