Re: makeAndExpr(), etc. confined to gram.y?

Lists: pgsql-hackers
From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: makeAndExpr(), etc. confined to gram.y?
Date: 2014-06-25 04:14:42
Message-ID: CA+HiwqE2fSsMZYm9VwBi4HaxSSoABHSu9kk9bqJUPug1u=4xTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

A recent commit titled "Avoid recursion when processing simple lists
of AND'ed or OR'ed clauses."
(2146f13408cdb85c738364fe8f7965209e08c6be) got rid of AEXPR_AND, etc.
and instead created makeAndExpr(), etc. in gram.y

Is there a reason why they've been left out of
makefuncs.h/makefuncs.c? Perhaps they are not supposed to be used
outside gram.y at all? For example, previously a caller (potentially)
outside parser could do a makeA_Expr(AEXPR_AND, ...). I guess this is
no longer possible with AEXPR_AND gone?

--
Amit


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: makeAndExpr(), etc. confined to gram.y?
Date: 2014-06-25 04:27:57
Message-ID: 75211.1403670477@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Amit Langote <amitlangote09(at)gmail(dot)com> writes:
> Is there a reason why they've been left out of
> makefuncs.h/makefuncs.c? Perhaps they are not supposed to be used
> outside gram.y at all? For example, previously a caller (potentially)
> outside parser could do a makeA_Expr(AEXPR_AND, ...). I guess this is
> no longer possible with AEXPR_AND gone?

What would be the purpose? There is noplace except gram.y that builds
raw parse trees.

regards, tom lane


From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: makeAndExpr(), etc. confined to gram.y?
Date: 2014-06-25 08:25:58
Message-ID: CA+HiwqHn9OHCksuOq6AC5iKGsXpQSLvjMMxuOUFmmGCRhkhHOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Jun 25, 2014 at 1:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Amit Langote <amitlangote09(at)gmail(dot)com> writes:
>> Is there a reason why they've been left out of
>> makefuncs.h/makefuncs.c? Perhaps they are not supposed to be used
>> outside gram.y at all? For example, previously a caller (potentially)
>> outside parser could do a makeA_Expr(AEXPR_AND, ...). I guess this is
>> no longer possible with AEXPR_AND gone?
>
> What would be the purpose? There is noplace except gram.y that builds
> raw parse trees.
>

Yeah, that is true. Sorry, I am unaware as to how generic make*
functions in gram.y are and how they differ from those in makefuncs.c.

So, use of make* family of functions outside parser is their abuse in
some way? Anything that needs to use these functions should somehow be
accomplished in parser perhaps. For example, duplicate/redundant CHECK
expressions elimination and such?

--
Amit


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: makeAndExpr(), etc. confined to gram.y?
Date: 2014-06-25 15:46:50
Message-ID: 75753.1403711210@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Amit Langote <amitlangote09(at)gmail(dot)com> writes:
> On Wed, Jun 25, 2014 at 1:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Amit Langote <amitlangote09(at)gmail(dot)com> writes:
>>> Is there a reason why they've been left out of
>>> makefuncs.h/makefuncs.c? Perhaps they are not supposed to be used
>>> outside gram.y at all? For example, previously a caller (potentially)
>>> outside parser could do a makeA_Expr(AEXPR_AND, ...). I guess this is
>>> no longer possible with AEXPR_AND gone?

>> What would be the purpose? There is noplace except gram.y that builds
>> raw parse trees.

> Yeah, that is true. Sorry, I am unaware as to how generic make*
> functions in gram.y are and how they differ from those in makefuncs.c.

> So, use of make* family of functions outside parser is their abuse in
> some way? Anything that needs to use these functions should somehow be
> accomplished in parser perhaps. For example, duplicate/redundant CHECK
> expressions elimination and such?

Well, the larger point here is that those functions are specific to
gram.y's problem of constructing multi-AND(OR) structures during a series
of binary production actions. I don't see that there's any use for them
elsewhere, and the way that they modify the input structures wouldn't
necessarily be safe anywhere else either.

regards, tom lane


From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: makeAndExpr(), etc. confined to gram.y?
Date: 2014-06-25 23:29:39
Message-ID: CA+HiwqEj926DgrxQ7g1Xik9mzd1uqOZja9GTZxMrBOdLmcqsRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jun 26, 2014 at 12:46 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Amit Langote <amitlangote09(at)gmail(dot)com> writes:
>> Yeah, that is true. Sorry, I am unaware as to how generic make*
>> functions in gram.y are and how they differ from those in makefuncs.c.
>
>> So, use of make* family of functions outside parser is their abuse in
>> some way? Anything that needs to use these functions should somehow be
>> accomplished in parser perhaps. For example, duplicate/redundant CHECK
>> expressions elimination and such?
>
> Well, the larger point here is that those functions are specific to
> gram.y's problem of constructing multi-AND(OR) structures during a series
> of binary production actions. I don't see that there's any use for them
> elsewhere, and the way that they modify the input structures wouldn't
> necessarily be safe anywhere else either.
>

I see. Thanks for clarifying.

--
Amit