Use bash and the postgres built-in array_agg
authorMike Rylander <mrylander@gmail.com>
Thu, 14 Jun 2012 11:34:12 +0000 (07:34 -0400)
committerDan Scott <dscott@laurentian.ca>
Mon, 30 Jul 2012 21:43:12 +0000 (17:43 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>

Open-ILS/examples/build-eg-replication.sh

index 83a1134..8c98ed4 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Copyright (C) 2009 Equinox Software, Inc.
 # Author: Mike Rylander <miker@esilibrary.com>
@@ -52,7 +52,7 @@ fi
 
 if [ "_$TABLES" == "_" ]; then
   TABLES=$(psql -tc "
-    select array_to_string(array_accum(table_schema || '.' || table_name),' ')
+    select array_to_string(array_agg(table_schema || '.' || table_name),' ')
       from information_schema.tables
       where table_schema in (
         'acq', 'action', 'action_trigger', 'actor', 'asset', 'asset_hist', 'auditor',
@@ -65,7 +65,7 @@ if [ "_$TABLES" == "_" ]; then
 fi
 
 if [ "_$SEQUENCES" == "_" ]; then
-  SEQUENCES=$(psql -tc "select array_to_string(array_accum(schemaname || '.' || relname),' ') from pg_statio_user_sequences;")
+  SEQUENCES=$(psql -tc "select array_to_string(array_agg(schemaname || '.' || relname),' ') from pg_statio_user_sequences;")
 fi