1 -- test plperl/plperlu interaction
3 -- the language and call ordering of this test sequence is useful
5 CREATE OR REPLACE FUNCTION bar() RETURNS integer AS $$
6 #die 'BANG!'; # causes server process to exit(2)
7 # alternative - causes server process to exit(255)
8 spi_exec_query("invalid sql statement");
9 $$ language plperl; -- compile plperl code
11 CREATE OR REPLACE FUNCTION foo() RETURNS integer AS $$
12 spi_exec_query("SELECT * FROM bar()");
14 $$ LANGUAGE plperlu; -- compile plperlu code
16 SELECT * FROM bar(); -- throws exception normally (running plperl)
17 SELECT * FROM foo(); -- used to cause backend crash (after switching to plperlu)
19 -- test redefinition of specific SP switching languages
20 -- http://archives.postgresql.org/pgsql-bugs/2010-01/msg00116.php
23 create or replace function foo(text) returns text language plperl as 'shift';
25 create or replace function foo(text) returns text language plperlu as 'shift';
27 create or replace function foo(text) returns text language plperl as 'shift';
31 create or replace function bar(text) returns text language plperlu as 'shift';
33 create or replace function bar(text) returns text language plperl as 'shift';
35 create or replace function bar(text) returns text language plperlu as 'shift';
39 -- Make sure we can't use/require things in plperl
42 CREATE OR REPLACE FUNCTION use_plperlu() RETURNS void LANGUAGE plperlu
47 CREATE OR REPLACE FUNCTION use_plperl() RETURNS void LANGUAGE plperl
52 -- make sure our overloaded require op gets restored/set correctly
55 CREATE OR REPLACE FUNCTION use_plperl() RETURNS void LANGUAGE plperl