Re: Optimizing nested ConvertRowtypeExpr execution

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: ashutosh(dot)bapat(at)enterprisedb(dot)com, 9erthalion6(at)gmail(dot)com, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, pavel(dot)stehule(at)gmail(dot)com, andres(at)anarazel(dot)de, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimizing nested ConvertRowtypeExpr execution
Date: 2018-11-06 20:05:26
Message-ID: 87ftwe0yej.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

Tom> * I dislike using castNode() in places where the code has just
Tom> explicitly verified the node type, which is true in both places
Tom> where you used it here. The assertion is just bulking the code up
Tom> to no purpose, and it creates an unnecessary discrepancy between
Tom> older and newer code.

hmm... fair point, I'll think about it

Tom> * As you have it here, a construct such as
Tom> ConvertRowtypeExpr(ConvertRowtypeExpr(ConvertRowtypeExpr(Const)))
Tom> will laboriously perform each of the intermediate steps, which
Tom> seems like exactly the case we're trying to prevent at runtime. I
Tom> wonder whether it is worth stripping off ConvertRowtypeExpr's
Tom> before the recursive eval_const_expressions_mutator call to
Tom> prevent that. You'd still want the check after the call, to handle
Tom> situations where something more complex got simplified to a
Tom> ConvertRowtypeExpr; and this would also complicate getting the
Tom> convertformat right. So perhaps it's not worth the trouble, but I
Tom> thought I'd mention it.

I think it's not worth the trouble.

Tom> * I find the hardwired logic about how to merge distinct
Tom> convertformat values a bit troublesome. Maybe use Min() instead?
Tom> Although there is not currently any expectation about the ordering
Tom> of that enum ...

I considered using Min() but decided against it specifically _because_
there was no suggestion either in the enum definition, or in any other
use of CoercionForm anywhere, that the order of values was intended to
be significant. Since there's only one value for "implicit", it seemed
better to work from that.

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-11-06 20:14:08 Re: backend crash on DELETE, reproducible locally
Previous Message Ondřej Bouda 2018-11-06 19:54:31 Re: backend crash on DELETE, reproducible locally