Re: Patch: clean up addRangeTableEntryForFunction

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: clean up addRangeTableEntryForFunction
Date: 2013-01-23 18:10:41
Message-ID: 20130123181041.GA2432@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 22, 2013 at 11:02:18PM -0500, Tom Lane wrote:
> David Fetter <david(at)fetter(dot)org> writes:
> > I've been working with Andrew Gierth (well, mostly he's been doing
> > the work, as usual) to add WITH ORDINALITY as an option for
> > set-returning functions. In the process, he found a minor
> > opportunity to clean up the interface for $SUBJECT, reducing the
> > call to a Single Point of Truth for lateral-ness, very likely
> > improving the efficiency of calls to that function.
>
> As I mentioned in our off-list discussion, I think this is going in
> the wrong direction. It'd make more sense to me to get rid of the
> RangeFunction parameter, instead passing the two fields that
> addRangeTableEntryForFunction actually uses out of that.

With utmost respect, of the four fields currently in RangeFunction:
type (tag), lateral, funccallnode, alias, and coldeflist, the function
needs three (all but funccallnode, which has already been transformed
into a funcexpr). The patch for ordinality makes that 4/5 with the
ordinality field added.

> If we do what you have here, we'll be welding together the alias and
> lateral settings for the new RTE; which conceivably some other
> caller would want to specify in a different way. As a comparison
> point, you might want to look at the various calls to
> addRangeTableEntryForSubquery: some of those pass multiple fields
> out of the same RangeSubselect, and some do not.

As to addRangeTableEntryForSubquery, I'm not seeing the connection to
the case at hand. Could you please spell it out?

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2013-01-23 18:12:37 Re: Patch: UNNEST (and other functions) WITH ORDINALITY
Previous Message Alvaro Herrera 2013-01-23 18:08:41 Re: BUG #6510: A simple prompt is displayed using wrong charset