On 09/05/2011 05:27 PM, Andy Colson wrote:
On 09/05/2011 05:04 PM, Andrew Dunstan wrote:
On 09/05/2011 05:03 PM, Andy Colson wrote:
Pavel, this patch:
https://commitfest.postgresql.org/action/patch_view?id=624
It applied clean and compiled ok, but I cannot get it to work at all.
$ psql
Timing is on.
psql (9.2devel)
Type "help" for help.
andy=# set plpgsql.prepare_plans to on_start;
ERROR: unrecognized configuration parameter "plpgsql.prepare_plans"
Did you add plpgsql to custom_variable_classes? It looks like you might not
have. (I'm not sure why plpgsql switch should require one, though, especially
since we now load plpgsql by default. It might be better just to call it
plpgsql_prepare_on_start.)
cheers
andrew
Ah, yep, that was the problem, thank you.
-Andy
However I still cannot get it to work.
andy=# set plpgsql.prepare_plans to on_start;
SET
Time: 0.123 ms
andy=# show plpgsql.prepare_plans;
plpgsql.prepare_plans
-----------------------
on_start
(1 row)
andy=# create or replace function test1(a integer) returns integer as $$
andy$# begin
andy$# return b+1;
andy$# end;
andy$# $$ language plpgsql;
CREATE FUNCTION
Time: 16.926 ms
andy=#
Oh... shoot, having gone back and read more closely I realize I didnt
understand. I thought the sql would be checked on create. That's not the case.
This is what I'd hopped it was:
create table junk1 (
id serial,
code1 integer,
);
create or replace function test2() returns integer as $$
declare
x integer;
begin
select bob into x from junk1 where id = 4;
return x;
end;
$$ language plpgsql;
I was thinking the create function would immediately return saying, unknown
column bob, and not create the function.
So now with the function above, this patch has not helped me at all. I wont
get an error until I exec the function. Just like without the patch.
I'm not so sure how helpful that is. What is you use the "if false then ... end
if" trick to comment out some old code? You're sill going to check the tables and
fields on every exec?
Pavel, is there any way to move all that code to the create function? But,
then that would create a dependency where there is not one now. So that would
be bad.
How about a new "check function test2()" type of call? I think having the
tables/fields checked just once would be better than checking them over and over on ever
single execute.
-Andy
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers