pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Martijn van Oosterhout <kleptog@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY
Date: Wed, 03 Aug 2022 10:09:12 -0400
Message-ID: <2967745.1659535752@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMbWs49WiiONtw7-zje2O31GOwZ4XxZNNub=Y_ChA4ecC9x3yQ@mail.gmail.com>
References: <17564-c7472c2f90ef2da3@postgresql.org>
	<2184335.1659392231@sss.pgh.pa.us>
	<CADWG95s03YZsRy3+q0bQFXW_v_f-9vMvcFOo6KUL08DvqbXhqg@mail.gmail.com>
	<CAMbWs49AgGUophtyThqHhSUyDTu3h6oATg-7GgowCtvHWCh9qQ@mail.gmail.com>
	<CAMbWs49WiiONtw7-zje2O31GOwZ4XxZNNub=Y_ChA4ecC9x3yQ@mail.gmail.com>

Richard Guo <guofenglinux@gmail.com> writes:
> -               if (IS_SRF_CALL((Node *) em->em_expr))
> +               if (expression_returns_set((Node *) em->em_expr))

Yeah.  I think we need to go further: placed in optimizer.h as
it is, IS_SRF_CALL is just an invitation to writing broken code.
I think the calls in tlist.c are legit because that code is
precisely concerned with breaking down nests of SRFs; but
everywhere else, if you write IS_SRF_CALL you're doing it wrong.
We should take that macro out of the header altogether.

I kind of wonder whether IS_SRF_CALL is a good idea at all.
It'd be more maintainable to have an expression_returns_set_one_level,
or something like that, placed beside expression_returns_set.

			regards, tom lane





view thread (18+ messages)  latest in thread

Message-ID: <2967745.1659535752@sss.pgh.pa.us>
Permalink:  ../2967745.1659535752@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2967745.1659535752@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, guofenglinux@gmail.com, kleptog@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY
  In-Reply-To: <2967745.1659535752@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