El 19/9/19 a las 10:07, Achilleas
Mantzios escribió:
I'm not sure about what do you mean when you say to load plpgsql in my cluster. But after your mail, and after discussing it with nearby people I've used a simple function that is included in one of our databases to check the language exists or not in each server. This is the function (is really silly function, nothing but a now() formatted): CREATE OR REPLACE FUNCTION fn_now() I've created it in PG 10.10 and called from a select: no problem. I've created an empty database in PG 8.4 and created this
function in this new database. It gives me an error that says
(more or less as I get the error in another language different
than english) : "ERROR: «plpgsql» does not exist. SUGGESTION:
Use CREATE LANGUAGE to install language in database.". With these results, finally I've: 1- modified template1 in PG 8.4 server to include plpgsql
language, so it can be inherited in new databases created from
this template. 2- Dropped and recreated my database (let's call it newdb). 3- Modified backup file to remove the part that creates the function plpgsql_call_handler(). 4- Restored modified backup. ekaterina@mymachine:~/temp$ /usr/lib/postgresql/8.4/bin/psql -U postgres psql (8.4.22) postgres=# \c template1 template1=# CREATE LANGUAGE plpgsql; CREATE LANGUAGE template1=# create database newdb with owner=root template=template1; CREATE DATABASE newdb=# \q ekaterina@mymachine:~/temp$ /usr/lib/postgresql/8.4/bin/psql -U root -d newdb < backup_from_7_14.sql > errors.log Backup is restored without errors, and functions are created correctly. I can call them without errors. And testing pg_upgrade with --check modifier now returns OK. The conclusion is that I can avoid the use of plpgsql.so library. My question now would be related about the creation of the language in version 8.4: is it better to create it at template level or at database level? Of course creating it at template level leads to language being included in new databases without effort. And as it's plpgsql language, which is the only way we use at my place for programming database, it lets me foget about installing it in new databases. Also, since 9.0 version plpgsql language is installed by default in every database and all of this becomes unnecesary. But I'd like to know if I'm missing anything important.
Thanks Achilleas for your tips.
--Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt |