From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: plpgsql - execute - cannot use a reference to record field |
Date: | 2019-04-15 17:00:52 |
Message-ID: | CAFj8pRB4m7hhMOC2NKX+nQoTc+v7O6dxtxi5XvSTymsMLQyz0Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | Postg토토 캔SQL : |
po 15. 4. 2019 v 18:07 odesílatel Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> napsal:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> > Is there reason why following code should not to work?
>
> > do $$
> > declare r record; result int;
> > begin
> > select 10 as a, 20 as b into r;
> > raise notice 'a: %', r.a;
> > execute 'select $1.a + $1.b' into result using r;
> > raise notice '%', result;
> > end;
> > $$
>
> You can't select fields by name out of an unspecified record.
> The EXECUTE'd query is not particularly different from
>
> regression=# prepare foo(record) as select $1.a + $1.b;
> psql: ERROR: could not identify column "a" in record data type
> LINE 1: prepare foo(record) as select $1.a + $1.b;
> ^
>
> and surely you wouldn't expect that to work.
> (The fact that either of the previous lines work is
> thanks to plpgsql-specific hacking.)
>
yes. I looking to the code and I see so SPI_execute_with_args doesn't allow
push typmods there.
Regards
Pavel
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-04-15 17:13:01 | Re: New vacuum option to do only freezing |
Previous Message | Tomas Vondra | 2019-04-15 16:55:33 | Re: Multivariate MCV lists -- pg_mcv_list_items() seems to be broken |