pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Hans Spaans <pgsql-admin@lists.hansspaans.nl>
Cc: pgsql-admin@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] concat_ws
Date: Sun, 03 Aug 2003 16:16:11 -0700
Message-ID: <3F2D97BB.3060600@joeconway.com> (raw)
In-Reply-To: <1680.1059949492@sss.pgh.pa.us>
References: <20030803131931.GD4326@sch01r01.nexit.nl>
	<26941.1059926135@sss.pgh.pa.us>
	<3F2D4B3B.3050405@joeconway.com>
	<6571.1059934474@sss.pgh.pa.us>
	<3F2D84FF.3070304@joeconway.com>
	<1680.1059949492@sss.pgh.pa.us>

Tom Lane wrote:
> Yeah.  The problem is that the SQL function inliner generates an
> enormous expression tree from this function definition.  7.3 had no
> inliner so no problem.

But I wonder why it isn't at all a problem when the function is also 
defined STRICT?

I also looked back at the greatest() example -- similar behavior. If 
defined
   ...language sql;
or
   ...language sql IMMUTABLE STRICT;
it works great.

But when defined
   ...language sql IMMUTABLE;
it dies a horrible recursive death.

In case 1 above, the function doesn't get inlined at all, right? But in 
both case 2 and 3, it should get inlined -- why does 2 work fine when 3 
doesn't?

> I am not sure what to do about it --- the only idea that comes to mind
> is to put an arbitrary limit (of, say, 5 or 10 function calls) on the
> depth of inlining expansion.  That seems like a pretty ugly answer
> ... anyone have a better one?

But as above, case 2 is inlined (I think) and works fine -- why restrict it.

> Your definition of concat_ws bears some passing resemblance to the
> infamous Ackermann's function, btw.

I always knew I was destined to be infamous ;-)

Joe




view thread (15+ messages)  latest in thread

Message-ID: <3F2D97BB.3060600@joeconway.com>
Permalink:  ../3F2D97BB.3060600@joeconway.com/
Also on:    postgresql.org/message-id/3F2D97BB.3060600@joeconway.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mail@joeconway.com, tgl@sss.pgh.pa.us, pgsql-admin@lists.hansspaans.nl, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] concat_ws
  In-Reply-To: <3F2D97BB.3060600@joeconway.com>
  References: <20030803131931.GD4326@sch01r01.nexit.nl> <26941.1059926135@sss.pgh.pa.us> <3F2D4B3B.3050405@joeconway.com> <6571.1059934474@sss.pgh.pa.us> <3F2D84FF.3070304@joeconway.com> <1680.1059949492@sss.pgh.pa.us> <3F2D97BB.3060600@joeconway.com>

* 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