Re: [GENERAL] Question about function body checking and 8.1

2005-03-23 Thread Martijn van Oosterhout
On Tue, Mar 22, 2005 at 09:04:42PM -0600, Tony Caduto wrote: > > CREATE OR REPLACE FUNCTION mytest(); > RETURNS VOID as > $$ > DECLARE > mytestvar varchar; > mytestvar2 integer; > BEGIN > mytestvarr = 'bla'; > select testfield from nonexistanttable where testfield = 2 > INTO myt

Re: [GENERAL] Question about function body checking and 8.1

2005-03-23 Thread Tom Lane
Sean Davis <[EMAIL PROTECTED]> writes: > On Mar 22, 2005, at 10:04 PM, Tony Caduto wrote: >> Also if you happen to use PLperl or any of the other ones, do they >> actually do better checking than PLpgsql? Last time I used a PLperl >> function it didn't do any checking at creation either. > I t

Re: [GENERAL] Question about function body checking and 8.1

2005-03-23 Thread Sean Davis
On Mar 22, 2005, at 10:04 PM, Tony Caduto wrote: Ok, here is a example CREATE OR REPLACE FUNCTION mytest(); RETURNS VOID as $$ DECLARE mytestvar varchar; mytestvar2 integer; BEGIN mytestvarr = 'bla'; select testfield from nonexistanttable where testfield = 2 INTO mytestvar2;

Re: [GENERAL] Question about function body checking and 8.1

2005-03-22 Thread Tony Caduto
Ok, here is a example CREATE OR REPLACE FUNCTION mytest(); RETURNS VOID as $$ DECLARE mytestvar varchar; mytestvar2 integer; BEGIN mytestvarr = 'bla'; select testfield from nonexistanttable where testfield = 2 INTO mytestvar2; --The table does not exits, yet postgresql d

Re: [GENERAL] Question about function body checking and 8.1

2005-03-22 Thread Peter Eisentraut
Tom Lane wrote: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > Implementing this type of syntax checker isn't hard since the code > > is already there, but there might be a small, ugly problem. IIRC, > > the parser and/or semantic analyzer of PL/pgSQL relies on knowing > > whether the function

Re: [GENERAL] Question about function body checking and 8.1

2005-03-22 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Implementing this type of syntax checker isn't hard since the code is > already there, but there might be a small, ugly problem. IIRC, the > parser and/or semantic analyzer of PL/pgSQL relies on knowing whether > the function is called as a trigger

Re: [GENERAL] Question about function body checking and 8.1

2005-03-22 Thread Peter Eisentraut
Alvaro Herrera wrote: > On Tue, Mar 22, 2005 at 06:09:28PM +0100, Peter Eisentraut wrote: > > [EMAIL PROTECTED] wrote: > > > currently when you execute a CREATE OR REPLACE FUNCTION there is > > > virtually no checking of the function body for variable type > > > compatibility or if the SQL statemen

Re: [GENERAL] Question about function body checking and 8.1

2005-03-22 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > alvherre=# create function test_syntax() returns void language plpgsql as > 'begin zelect 1; return; end'; > CREATE FUNCTION > alvherre=# select test_syntax(); > ERROR: error de sintaxis en o cerca de «zelect» en el carácter 1 > QUERY: zelect 1 > CONT

Re: [GENERAL] Question about function body checking and 8.1

2005-03-22 Thread Alvaro Herrera
On Tue, Mar 22, 2005 at 06:09:28PM +0100, Peter Eisentraut wrote: > [EMAIL PROTECTED] wrote: > > currently when you execute a CREATE OR REPLACE FUNCTION there is > > virtually no checking of the function body for variable type > > compatibility or if the SQL statements are valid. > > Only for ver

Re: [GENERAL] Question about function body checking and 8.1

2005-03-22 Thread Richard Huxton
[EMAIL PROTECTED] wrote: Hi, currently when you execute a CREATE OR REPLACE FUNCTION there is virtually no checking of the function body for variable type compatibility or if the SQL statements are valid. It's not a big deal for long time users of Postgres, but for users migrating from systems such

Re: [GENERAL] Question about function body checking and 8.1

2005-03-22 Thread Peter Eisentraut
[EMAIL PROTECTED] wrote: > currently when you execute a CREATE OR REPLACE FUNCTION there is > virtually no checking of the function body for variable type > compatibility or if the SQL statements are valid. Only for very small values of "no". Please provide an example. -- Peter Eisentraut http

[GENERAL] Question about function body checking and 8.1

2005-03-22 Thread tony_caduto
Hi, currently when you execute a CREATE OR REPLACE FUNCTION there is virtually no checking of the function body for variable type compatibility or if the SQL statements are valid. It's not a big deal for long time users of Postgres, but for users migrating from systems such as MS SQL or Oracle