Re: plpgsql - execute - cannot use a reference to record field

2019-04-15 Thread Pavel Stehule
po 15. 4. 2019 v 18:07 odesílatel Tom Lane napsal: > Pavel Stehule 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' i

Re: plpgsql - execute - cannot use a reference to record field

2019-04-15 Thread Tom Lane
Pavel Stehule 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

plpgsql - execute - cannot use a reference to record field

2019-04-14 Thread Pavel Stehule
Hi 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; $$ but it fails NOTICE: a: 10 ERROR: could not