Re: BUG #19923: SEARCH/CYCLE with DISTINCT in the recursive term: rows depend on input order

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: tharakan(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19923: SEARCH/CYCLE with DISTINCT in the recursive term: rows depend on input order
Date: 2026-11-20 17:52:54
Message-ID: 1536293.1795197174@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-11-20 18:17:17 Re: BUG #19923: SEARCH/CYCLE with DISTINCT in the recursive term: rows depend on input order
Previous Message Colin McDonnell 2026-11-20 17:46:40 Re: Anti-wraparound autovacuum stops for good after no slot available for new autovacuum worker process