pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Deparsing rewritten query
Date: Sun, 27 Jun 2021 10:34:52 -0400
Message-ID: <3176554.1624804492@sss.pgh.pa.us> (raw)
In-Reply-To: <20210627041138.zklczwmu3ms4ufnk@nol>
References: <20210627041138.zklczwmu3ms4ufnk@nol>

Julien Rouhaud <rjuju123@gmail.com> writes:
> As an alternative, maybe we could expose a simple SRF that would take care of
> rewriting the query and deparsing the resulting query tree(s)?

I'm not really excited by this, as it seems like it's exposing internal
decisions we could change someday; to wit, first that there is any such
thing as a separate rewriting pass, and second that its output is
interpretable as pure SQL.  (TBH, I'm not 100% sure that the second
assumption is true even today, although I know there are ancient comments
that claim that.)  It's not very hard to imagine someday moving view
expansion into the planner on efficiency grounds, leaving the rewriter
handling only the rare uses of INSERT/UPDATE/DELETE rules.

If there's functions in ruleutils.c that we'd need to make public to
let somebody write a debugging extension that does this kind of thing,
I'd be happier with that approach than with creating a core-server SQL
function for it.  There might be more than one use-case for the
exposed bits.

			regards, tom lane





view thread (24+ messages)  latest in thread

Message-ID: <3176554.1624804492@sss.pgh.pa.us>
Permalink:  ../3176554.1624804492@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3176554.1624804492@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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rjuju123@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Deparsing rewritten query
  In-Reply-To: <3176554.1624804492@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