Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-12 Thread Pavel Stehule
Hello I started work on proposed check statement option and there are a few questions? what is sense of this statement for others PL? When we solve a mainly PL/pgSQL issue, has sense to implement new statement? Isn't a some problem in our CREATE FUNCTION design? A separation to two steps should

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-12 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: I started work on proposed check statement option and there are a few questions? what is sense of this statement for others PL? IMO you should design this as a call to the PL's validator function. It's not necessary to make other PLs do anything

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-11 Thread Pavel Stehule
       CHECK FUNCTION function_name(arglist); I proposed a stored procedure check_function(name, arglist), but CHECK FUNCTION is ok for me too. Is easy implement it. Maybe there is issue - CHECK will be a keyword :( CHECK is reserved keyword now, so this is issue. sorry for noise Pavel

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-11 Thread Dimitri Fontaine
Tom Lane t...@sss.pgh.pa.us writes: I'm not that happy with overloading the ANALYZE keyword to mean this (especially not since there is already meaning attached to the syntax ANALYZE x(y)). But we could certainly use some other name --- I'm inclined to suggest CHECK: CHECK FUNCTION

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-10 Thread Andy Colson
Purpose Better test coverage of functions. On first call of a function, all sql statements will be prepared, even those not directly called. Think: create function test() returns void as $$ begin if false then select badcolumn from badtable; end if; end; $$ language plpgsql;

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-10 Thread Tom Lane
Andy Colson a...@squeakycode.net writes: [ Andy's dubious about adding plpgsql syntax to control this feature ] Yeah, that bothers me a lot too. One option I'd thought about, was to extended ANALYZE to support functions. That's actually quite a good idea, not least because the extra checking

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-10 Thread Marti Raudsepp
On Sun, Sep 11, 2011 at 01:21, Tom Lane t...@sss.pgh.pa.us wrote: I'm not that happy with overloading the ANALYZE keyword to mean this But we could certainly use some other name --- I'm inclined to suggest CHECK:        CHECK FUNCTION function_name(arglist); Just a thought:

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-10 Thread Tom Lane
Marti Raudsepp ma...@juffo.org writes: On Sun, Sep 11, 2011 at 01:21, Tom Lane t...@sss.pgh.pa.us wrote: I'm not that happy with overloading the ANALYZE keyword to mean this But we could certainly use some other name --- I'm inclined to suggest CHECK: CHECK FUNCTION

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-10 Thread Pavel Stehule
Hello thank you very much for review Will always throw an error because at prepare time, the temp junk table wont exist.  This patch implements new syntax to disable the check: create function test5() returns integer as $$ #prepare_plans on_demand begin ... Was it Tom Lane that said, if

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-10 Thread Pavel Stehule
Hello 2011/9/11 Tom Lane t...@sss.pgh.pa.us: Andy Colson a...@squeakycode.net writes: [ Andy's dubious about adding plpgsql syntax to control this feature ] Yeah, that bothers me a lot too. I like to discussion about syntax - a name prepare_plans and following list is just one (for me -

Re: [HACKERS] [REVIEW] prepare plans of embedded sql on function start

2011-09-10 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: I like to discussion about syntax - a name prepare_plans and following list is just one (for me - practical) shot. I am sure so preparing all plans on function start is one functionality what we want - because it can to do early warnings when some

Re: [HACKERS] Review: prepare plans of embedded sql on function start

2011-09-06 Thread Andy Colson
Hi Pavel, I can get: ERROR: permission denied to set parameter plpgsql.prepare_plans with this script: set plpgsql.prepare_plans to on_start; create or replace function test1(a integer) returns integer as $$ begin return a+1; end; $$ language plpgsql; If test1() exists, then this script

[HACKERS] Review: prepare plans of embedded sql on function start

2011-09-05 Thread Andy Colson
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

Re: [HACKERS] Review: prepare plans of embedded sql on function start

2011-09-05 Thread Andrew Dunstan
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

Re: [HACKERS] Review: prepare plans of embedded sql on function start

2011-09-05 Thread Andy Colson
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

Re: [HACKERS] Review: prepare plans of embedded sql on function start

2011-09-05 Thread Andy Colson
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