root/trunk/db-tests/00-prepare.sql

Revision 71, 0.9 kB (checked in by depesz, 4 years ago)

db-tests framework. Currently tests plperl if it works sanely

Line 
1 BEGIN;
2
3 -- This is basically CREATE LANGUAGE IF NOT EXISTS - vide http://andreas.scherbaum.la/blog/archives/346-create-language-if-not-exist.html
4     CREATE OR REPLACE FUNCTION public.create_plpgsql_language () RETURNS setof TEXT AS $$ CREATE LANGUAGE plpgsql; SELECT 'x'::TEXT WHERE 1=0;$$ LANGUAGE 'sql';
5     SELECT public.create_plpgsql_language () WHERE NOT exists (SELECT * FROM pg_language WHERE lanname='plpgsql');
6     DROP FUNCTION public.create_plpgsql_language ();
7 -- This is basically CREATE LANGUAGE IF NOT EXISTS - vide http://andreas.scherbaum.la/blog/archives/346-create-language-if-not-exist.html
8
9     CREATE SCHEMA pgtap;
10     SET search_path TO pgtap, public;
11     \i /home/pgdba/work-8.4.1/share/postgresql/contrib/pgtap.sql
12
13     CREATE OR REPLACE FUNCTION execute(TEXT) RETURNS void as $$BEGIN execute $1; END;$$ language plpgsql;
14     SELECT execute('ALTER DATABASE ' || quote_ident( current_database() ) || ' SET search_path = pgtap, public');
15
16 COMMIT;
Note: See TracBrowser for help on using the browser.