Re: Hook for extensible parsing. - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Hook for extensible parsing.
Date
Msg-id 20210915204150.cipnwe266pya32ne@alap3.anarazel.de
Whole thread Raw
In response to Re: Hook for extensible parsing.  ("Jonah H. Harris" <jonah.harris@gmail.com>)
List pgsql-hackers
Hi,

On 2021-09-15 16:35:53 -0400, Jonah H. Harris wrote:
> On Wed, Sep 15, 2021 at 3:55 PM Andres Freund <andres@anarazel.de> wrote:
> > On 2021-09-15 12:57:00 -0400, Tom Lane wrote:
> > Agreed - it doesn't make sense to me to have a hook that only replaces raw
> > parsing, without also hooking into parse-analysis. ISTM that the least a
> > patchset going for a parser hook would have to do is to do sufficient
> > restructuring so that one could hook together into both raw parsing and
> > analysis. It could still be two callbacks, but perhaps we'd ensure that
> > they're both set.
> >
> 
> This is a bad example as it doesn't require semantic analysis from
> Postgres.

"it"? I assume you mean a different type of join? If so, I'm highly doubtful -
without semantic analysis you can't really handle column references.


> While most of the tools out there tend to do simple replacement,
> this can be done within a custom parser by simply walking its own AST,
> evaluating join conditions against the expression, and rewriting the join
> accordingly. Or, do you have an example that couldn't be done this way
> within a custom parser?

You cannot just "evaluate conditions" in a raw parse tree... You don't even
know what things are functions, columns etc, nor to what relation a column
belongs.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: Hook for extensible parsing.
Next
From: Tom Lane
Date:
Subject: Re: Hook for extensible parsing.