Skip site navigation (1) Skip section navigation (2)

Re: [COMMITTERS] pgsql: Add notion of a "transform function" that can simplify function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Add notion of a "transform function" that can simplify function
Date: 2012-03-23 16:27:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committerspgsql-hackers
I wrote:
> However, see my response to Robert: why are we passing the original node
> to the transform function at all?  It would be more useful and easier to
> work with to pass the function's fully-processed argument list, I believe.

After a bit of looking around, I realize that the current implementation
of transform functions is flat-out wrong, because whenever a transform
actually fires, it proceeds to throw away all the work that
eval_const_expressions has done on the input, and instead return some
lightly-modified version of the original node tree.  Thus for example
in the regression database:

regression=# create function foo(x float8, y int) returns numeric as
regression-# 'select ($1 + $2)::numeric' language sql;

regression=# select "numeric"(foo(y := 1, x := f1), -1) from float8_tbl;
ERROR:  unrecognized node type: 310

since the adjustment of foo's named arguments is thrown away.

So this patch is going to need some work.  I continue to not see any
particular reason why the transform function should need the original
node tree.  I think what it *should* be getting is the OID of the
function (currently, it's impossible for one transform to serve more
than one function, which seems like it might be useful); the input
collation (currently, transforms are basically unusable for any
collation-sensitive function), and the pre-simplified argument list.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Greg StarkDate: 2012-03-23 16:29:28
Subject: Re: query cache
Previous:From: Dimitri FontaineDate: 2012-03-23 16:12:22
Subject: Re: Finer Extension dependencies

pgsql-committers by date

Next:From: Tom LaneDate: 2012-03-23 16:52:31
Subject: Re: [COMMITTERS] pgsql: Add notion of a "transform function" that can simplify function
Previous:From: Noah MischDate: 2012-03-23 16:09:56
Subject: Re: [COMMITTERS] pgsql: Add notion of a "transform function" thatcan simplify function

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group