From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: tharakan@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19923: SEARCH/CYCLE with DISTINCT in the recursive term: rows depend on input order
Date: Fri, 20 Nov 2026 12:52:54 -0500
Message-ID: <1536293.1795197174@sss.pgh.pa.us> (raw)
In-Reply-To: <1535856.1795196546@sss.pgh.pa.us>
References: <19923-24cef1e958fa2370@postgresql.org>
<1535856.1795196546@sss.pgh.pa.us>
I wrote:
> ... The only way that this is stable
> is if the extra columns are absolutely, positively guaranteed to
> be immutable functions of the regular columns. Do we want to
> assume that? The main hazard I see is that we allow a much
> wider range of <cycle mark value> and <non-cycle mark value>
> than the spec contemplates, eg we will happily take
> "timestamptz 'now'" as a mark value.
Oh wait, you can reach the issue without anything terribly fancy,
because while we require the mark values to be constants, we don't
insist on them being of identical type, and will insert a cast
instead. If the cast is mutable, say timestamp to timestamptz,
then so is the cycle expression. I'm not sure we have any casts
that are volatile enough to change output mid-query, but we don't
forbid that.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, peter@eisentraut.org, tharakan@gmail.com
Subject: Re: BUG #19923: SEARCH/CYCLE with DISTINCT in the recursive term: rows depend on input order
In-Reply-To: <1536293.1795197174@sss.pgh.pa.us>
References: <19923-24cef1e958fa2370@postgresql.org> <1535856.1795196546@sss.pgh.pa.us> <1536293.1795197174@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox