Re: "fix" for plpgsql polymorphism

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: "fix" for plpgsql polymorphism
Date: 2003-07-19 04:17:32
Message-ID: 3F18C65C.4080105@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

I'm going to resend the patches that I have outstanding since it appears
some may have been lost. Here's the first.
==========================================

Tom Lane wrote:
>>You can alias $0, similar to the argument variables. And, I confirmed
>>that you cannot change the value, similar to the argument variables:
>
> Perhaps you shouldn't mark it isconst; then it would actually have some
> usefulness (you could use it directly as a temporary variable to hold
> the intended result). I can't see much value in aliasing it if it's
> const, either.

OK; the only change in this version is "isconst = false;". Now you can
use $0 as a result placeholder if desired. E.g.:

create or replace function tmp(anyelement, anyelement) returns anyarray as '
declare
v_ret alias for $0;
v_el1 alias for $1;
v_el2 alias for $2;
begin
v_ret := ARRAY[v_el1, v_el2];
return v_ret;
end;
' language 'plpgsql';

create table f(f1 text, f2 text, f3 int, f4 int);
insert into f values ('a','b',1,2);
insert into f values ('z','x',3,4);

select tmp(f1,f2) from f;
select tmp(f3,f4) from f;

Joe

Attachment Content-Type Size
plpgsql-poly-fix.02.patch text/plain 1.5 KB

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2003-07-19 04:19:03 Re: [NOVICE] connectby(... pos_of_sibling)
Previous Message Bruce Momjian 2003-07-19 03:11:28 Re: [NOVICE] connectby(... pos_of_sibling)