Lp 1730726: Basic Patch to build the database with PostgreSQL 10.
authorJason Stephenson <jason@sigio.com>
Mon, 5 Nov 2018 19:37:19 +0000 (14:37 -0500)
committerBen Shum <ben@evergreener.net>
Fri, 14 Dec 2018 19:35:49 +0000 (14:35 -0500)
* Modify the evergreen.org_top() function, with code from Galen
  Charlton, to be non-set returning.

* Modify Open-ILS/src/support-scripts/eg_db_config.in to not strip the
  period from PostgreSQL version numbers and to use the first two
  components when checking for supported PostgreSQL versions.

* Add link from Open-ILS/src/sql/Pg/000.english.pg94.fts-config.sql
  to Open-ILS/src/sql/Pg/000.english.pg10.fts-config.sql.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Ben Shum <ben@evergreener.net>
Open-ILS/src/sql/Pg/000.english.pg10.fts-config.sql [new symlink]
Open-ILS/src/sql/Pg/990.schema.unapi.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.function.non-set-returning-evergreen.org_top.sql [new file with mode: 0644]
Open-ILS/src/support-scripts/eg_db_config.in

diff --git a/Open-ILS/src/sql/Pg/000.english.pg10.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg10.fts-config.sql
new file mode 120000 (symlink)
index 0000000..38504b5
--- /dev/null
@@ -0,0 +1 @@
+000.english.pg94.fts-config.sql
\ No newline at end of file
index a40d66f..b761fbb 100644 (file)
@@ -4,10 +4,9 @@ BEGIN;
 CREATE SCHEMA unapi;
 
 CREATE OR REPLACE FUNCTION evergreen.org_top()
-RETURNS SETOF actor.org_unit AS $$
+RETURNS actor.org_unit AS $$
     SELECT * FROM actor.org_unit WHERE parent_ou IS NULL LIMIT 1;
-$$ LANGUAGE SQL STABLE
-ROWS 1;
+$$ LANGUAGE SQL STABLE;
 
 CREATE OR REPLACE FUNCTION evergreen.array_remove_item_by_value(inp ANYARRAY, el ANYELEMENT)
 RETURNS anyarray AS $$
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.non-set-returning-evergreen.org_top.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.non-set-returning-evergreen.org_top.sql
new file mode 100644 (file)
index 0000000..fd8c882
--- /dev/null
@@ -0,0 +1,10 @@
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION evergreen.org_top()
+RETURNS actor.org_unit AS $$
+    SELECT * FROM actor.org_unit WHERE parent_ou IS NULL LIMIT 1;
+$$ LANGUAGE SQL STABLE;
+
+COMMIT:
index dc61d09..699dc7e 100755 (executable)
@@ -142,11 +142,11 @@ sub create_database {
        $ENV{'PGPASSWORD'} = $settings->{pw};
        $ENV{'PGPORT'} = $settings->{port};
        $ENV{'PGHOST'} = $settings->{host};
-       my @temp = `psql -d postgres -qtc 'show server_version;' | xargs | cut -d. -f 1,2 | tr -d '.'`;
+       my @temp = split(/ /, `psql -d postgres -qtc 'show server_version;' | xargs | cut -d. -f 1,2`);
        chomp $temp[0];
        my $pgversion = $temp[0];
        my $cmd;
-       unless ($pgversion >= '94') {
+       unless ($pgversion >= '9.4') {
         my @message = ();
                push(@message,
                        "\n------------------------------------------------------------------------------\n",
@@ -166,7 +166,7 @@ sub create_database {
                        push(@output, "\nYou may need to install the postgresql plperl package on the database server.\n");
                }
                if(grep/No such file or directory/, @output) {
-                       if($pgversion >= '91') {
+                       if($pgversion >= '9.1') {
                                push(@output, "\nYou may need to install the postgresql contrib package on the database server.\n"); 
                        } else {
                                push(@output, "\nYou may need to install the postgresql contrib package on this server.\n");