Skip to content

Commit

Permalink
Ensure that PL/PGSQL is available for cleaning in Test::SQL::DB.
Browse files Browse the repository at this point in the history
We use plpgsql to clean the database, which eventually also removes
plpgsql, but we actually need it to be there to begin with.
  • Loading branch information
mlawren committed Jul 17, 2012
1 parent e21913f commit 3d6f76b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions share/Pg/clean/01-clean.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
DROP FUNCTION IF EXISTS make_plpgsql();

CREATE OR REPLACE FUNCTION make_plpgsql() RETURNS VOID AS $$
CREATE LANGUAGE plpgsql;
$$ LANGUAGE SQL;

SELECT
CASE WHEN
EXISTS(
SELECT
1
FROM
pg_catalog.pg_language
WHERE
lanname='plpgsql'
)
THEN
NULL
ELSE
make_plpgsql()
END;

DROP FUNCTION IF EXISTS remove_all();

CREATE FUNCTION remove_all() RETURNS void AS $$
Expand Down

0 comments on commit 3d6f76b

Please sign in to comment.