Sakila/PostgreSQL: Don't fail if language plpgsql already exists

When using the Sakila DB with the Docker image postgres:12.1 the
initialisation fails with:
  ERROR:  language "plpgsql" already exists

With PostgreSQL 8.4 (see [1]) and earlier it was only possible to
execute:
  CREATE [ PROCEDURAL ] LANGUAGE name

Starting with PostgreSQL 9.0 (see [2]) it is possible to execute:
  CREATE [ OR REPLACE ] [ PROCEDURAL ] LANGUAGE name

This commit makes the SQL script incompatible with PostgreSQL 8.4
and earlier.

[1] https://www.postgresql.org/docs/8.4/sql-createlanguage.html
[2] https://www.postgresql.org/docs/9.0/sql-createlanguage.html
This commit is contained in:
Roland Weisleder 2019-12-26 13:15:17 +01:00
parent 5ccc6cddb6
commit 63588967b9
2 changed files with 2 additions and 1 deletions

View File

@ -19,7 +19,7 @@ COMMENT ON SCHEMA public IS 'Standard public schema';
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--
CREATE PROCEDURAL LANGUAGE plpgsql;
CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;
ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

View File

@ -40,6 +40,7 @@ Authors and contributors of jOOQ or parts of jOOQ in alphabetical order:
- Peter Ertl
- Richard Bradley
- Robin Stocker
- Roland Weisleder
- Samy Deghou
- Sander Plas
- Sean Wellington