-- plruby 0.4.2, ruby 1.8.1, pg 7.4.3, linux
-- 1. create a valid plruby function
create or replace function sqr(int4) returns int4 as '
args[0]*args[0]
' language 'plruby';
-- 2. test it
select sqr(5);
-- 3. recreate the function, with syntax error
create or replace function sqr(int4) returns int4 as '
args[0]*args[0]-
' language 'plruby';
-- 4. test it
select sqr(5);
-- 5. recreate the function, fix the syntax error
create or replace function sqr(int4) returns int4 as '
args[0]*args[0]
' language 'plruby';
-- 6. test it.
select sqr(5);
step 6 fails with:
ERROR: method `proc_1057896' not defined in Module
note:
* ok if using plpgsql
* ok if step 2 and/or 4 is skipped
* of if step 5 is replaced with DROP FUNCTION + CREATE FUNCTION
--
dave