[open-ils-commits] r9910 - in branches/acq-experiment: . Open-ILS/src/extras/import Open-ILS/src/sql/Pg

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Jun 22 22:35:47 EDT 2008


Author: erickson
Date: 2008-06-22 22:35:46 -0400 (Sun, 22 Jun 2008)
New Revision: 9910

Added:
   branches/acq-experiment/Open-ILS/src/sql/Pg/002.functions.aggregate.sql
Modified:
   branches/acq-experiment/
   branches/acq-experiment/Open-ILS/src/extras/import/marc2bre.pl
   branches/acq-experiment/Open-ILS/src/sql/Pg/020.schema.functions.sql
   branches/acq-experiment/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql
   branches/acq-experiment/Open-ILS/src/sql/Pg/build-db.sh
Log:
Merged revisions 9906,9908-9909 via svnmerge from 
svn://svn.open-ils.org/ILS/trunk

........
  r9906 | miker | 2008-06-21 19:49:38 -0400 (Sat, 21 Jun 2008) | 1 line
  
  by request of Jason, accept comma separated list of fields to --trash
........
  r9908 | dbs | 2008-06-22 14:04:55 -0400 (Sun, 22 Jun 2008) | 2 lines
  
  Fix typo from 9880 for upgrade SQL as well
........
  r9909 | dbs | 2008-06-22 14:19:05 -0400 (Sun, 22 Jun 2008) | 3 lines
  
  Move aggregate functions into their own file and add DROP statements.
  Resolves dependencies and makes the schema creation more robust.
........



Property changes on: branches/acq-experiment
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk:1-9903
   + /trunk:1-9909

Modified: branches/acq-experiment/Open-ILS/src/extras/import/marc2bre.pl
===================================================================
--- branches/acq-experiment/Open-ILS/src/extras/import/marc2bre.pl	2008-06-22 18:19:05 UTC (rev 9909)
+++ branches/acq-experiment/Open-ILS/src/extras/import/marc2bre.pl	2008-06-23 02:35:46 UTC (rev 9910)
@@ -50,6 +50,8 @@
 	'quiet'		=> \$quiet
 );
 
+ at trash_fields = split(/,/,join(',', at trash_fields));
+
 if ($enc) {
 	MARC::Charset->ignore_errors(1);
 	MARC::Charset->assume_encoding($enc);

Copied: branches/acq-experiment/Open-ILS/src/sql/Pg/002.functions.aggregate.sql (from rev 9909, trunk/Open-ILS/src/sql/Pg/002.functions.aggregate.sql)
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/002.functions.aggregate.sql	                        (rev 0)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/002.functions.aggregate.sql	2008-06-23 02:35:46 UTC (rev 9910)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2004-2008  Georgia Public Library Service
+ * Copyright (C) 2008  Equinox Software, Inc.
+ * Mike Rylander <miker at esilibrary.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+BEGIN;
+
+DROP AGGREGATE IF EXISTS array_accum(anyelement) CASCADE;
+
+CREATE AGGREGATE array_accum (
+	sfunc = array_append,
+	basetype = anyelement,
+	stype = anyarray,
+	initcond = '{}'
+);
+
+CREATE OR REPLACE FUNCTION public.first_agg ( anyelement, anyelement ) RETURNS anyelement AS $$
+	SELECT CASE WHEN $1 IS NULL THEN $2 ELSE $1 END;
+$$ LANGUAGE SQL STABLE;
+
+DROP AGGREGATE IF EXISTS  public.first(anyelement) CASCADE;
+
+CREATE AGGREGATE public.first (
+	sfunc	 = public.first_agg,
+	basetype = anyelement,
+	stype	 = anyelement
+);
+
+CREATE OR REPLACE FUNCTION public.last_agg ( anyelement, anyelement ) RETURNS anyelement AS $$
+	SELECT $2;
+$$ LANGUAGE SQL STABLE;
+
+DROP AGGREGATE IF EXISTS  public.last(anyelement) CASCADE;
+
+CREATE AGGREGATE public.last (
+	sfunc	 = public.last_agg,
+	basetype = anyelement,
+	stype	 = anyelement
+);
+
+CREATE OR REPLACE FUNCTION public.text_concat ( TEXT, TEXT ) RETURNS TEXT AS $$
+SELECT
+	CASE	WHEN $1 IS NULL
+			THEN $2
+		WHEN $2 IS NULL
+			THEN $1
+		ELSE $1 || ' ' || $2
+	END;
+$$ LANGUAGE SQL STABLE;
+
+DROP AGGREGATE IF EXISTS  public.agg_text(text) CASCADE;
+
+CREATE AGGREGATE public.agg_text (
+	sfunc	 = public.text_concat,
+	basetype = text,
+	stype	 = text
+);
+
+CREATE OR REPLACE FUNCTION public.tsvector_concat ( tsvector, tsvector ) RETURNS tsvector AS $$
+SELECT
+	CASE	WHEN $1 IS NULL
+			THEN $2
+		WHEN $2 IS NULL
+			THEN $1
+		ELSE $1 || ' ' || $2
+	END;
+$$ LANGUAGE SQL STABLE;
+
+DROP AGGREGATE IF EXISTS  public.agg_tsvector(tsvector) CASCADE;
+
+CREATE AGGREGATE public.agg_tsvector (
+	sfunc	 = public.tsvector_concat,
+	basetype = tsvector,
+	stype	 = tsvector
+);
+
+COMMIT;

Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/020.schema.functions.sql
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/020.schema.functions.sql	2008-06-22 18:19:05 UTC (rev 9909)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/020.schema.functions.sql	2008-06-23 02:35:46 UTC (rev 9910)
@@ -125,59 +125,7 @@
 	SELECT SUBSTRING(call_number_dewey($1) FROM 1 FOR $2);
 $$ LANGUAGE SQL STRICT IMMUTABLE;
 
-CREATE OR REPLACE FUNCTION public.first_agg ( anyelement, anyelement ) RETURNS anyelement AS $$
-	SELECT CASE WHEN $1 IS NULL THEN $2 ELSE $1 END;
-$$ LANGUAGE SQL STABLE;
-
-CREATE AGGREGATE public.first (
-	sfunc	 = public.first_agg,
-	basetype = anyelement,
-	stype	 = anyelement
-);
-
-CREATE OR REPLACE FUNCTION public.last_agg ( anyelement, anyelement ) RETURNS anyelement AS $$
-	SELECT $2;
-$$ LANGUAGE SQL STABLE;
-
-CREATE AGGREGATE public.last (
-	sfunc	 = public.last_agg,
-	basetype = anyelement,
-	stype	 = anyelement
-);
-
-CREATE OR REPLACE FUNCTION public.text_concat ( TEXT, TEXT ) RETURNS TEXT AS $$
-SELECT
-	CASE	WHEN $1 IS NULL
-			THEN $2
-		WHEN $2 IS NULL
-			THEN $1
-		ELSE $1 || ' ' || $2
-	END;
-$$ LANGUAGE SQL STABLE;
-
-CREATE AGGREGATE public.agg_text (
-	sfunc	 = public.text_concat,
-	basetype = text,
-	stype	 = text
-);
-
-CREATE OR REPLACE FUNCTION public.tsvector_concat ( tsvector, tsvector ) RETURNS tsvector AS $$
-SELECT
-	CASE	WHEN $1 IS NULL
-			THEN $2
-		WHEN $2 IS NULL
-			THEN $1
-		ELSE $1 || ' ' || $2
-	END;
-$$ LANGUAGE SQL STABLE;
-
-CREATE AGGREGATE public.agg_tsvector (
-	sfunc	 = public.tsvector_concat,
-	basetype = tsvector,
-	stype	 = tsvector
-);
-
-CREATE FUNCTION tableoid2name ( oid ) RETURNS TEXT AS $$
+CREATE OR REPLACE FUNCTION tableoid2name ( oid ) RETURNS TEXT AS $$
 	BEGIN
 		RETURN $1::regclass;
 	END;

Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql	2008-06-22 18:19:05 UTC (rev 9909)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql	2008-06-23 02:35:46 UTC (rev 9910)
@@ -18,7 +18,7 @@
 
 CREATE SCHEMA extend_reporter;
 
-CREATE TABLE extend_reporter.legcay_circ_count (
+CREATE TABLE extend_reporter.legacy_circ_count (
     id          BIGSERIAL   PRIMARY KEY REFERENCES asset.copy (id)
     circ_count  INT         NOT NULL DEFAULT 0
 );
@@ -26,7 +26,7 @@
 CREATE VIEW extend_reporter.full_circ_count AS
  SELECT cp.id, COALESCE(sum(c.circ_count), 0::bigint) + COALESCE(count(circ.id), 0::bigint) AS circ_count
    FROM asset."copy" cp
-   LEFT JOIN extend_reporter.legcay_circ_count c USING (id)
+   LEFT JOIN extend_reporter.legacy_circ_count c USING (id)
    LEFT JOIN "action".circulation circ ON circ.target_copy = c.id
   GROUP BY cp.id;
 

Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/build-db.sh
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/build-db.sh	2008-06-22 18:19:05 UTC (rev 9909)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/build-db.sh	2008-06-23 02:35:46 UTC (rev 9910)
@@ -6,6 +6,7 @@
 PGPASSWORD=$5 PGUSER=$4 PGHOST=$1 PGPORT=$2 PGDATABASE=$3 psql -f 000.english.pg$6.fts-config.sql
 PGPASSWORD=$5 PGUSER=$4 PGHOST=$1 PGPORT=$2 PGDATABASE=$3 psql -f 001.schema.offline.sql
 PGPASSWORD=$5 PGUSER=$4 PGHOST=$1 PGPORT=$2 PGDATABASE=$3 psql -f 002.schema.config.sql
+PGPASSWORD=$5 PGUSER=$4 PGHOST=$1 PGPORT=$2 PGDATABASE=$3 psql -f 002.functions.aggregate.sql
 PGPASSWORD=$5 PGUSER=$4 PGHOST=$1 PGPORT=$2 PGDATABASE=$3 psql -f 002.functions.config.sql
 PGPASSWORD=$5 PGUSER=$4 PGHOST=$1 PGPORT=$2 PGDATABASE=$3 psql -f 005.schema.actors.sql
 PGPASSWORD=$5 PGUSER=$4 PGHOST=$1 PGPORT=$2 PGDATABASE=$3 psql -f 006.schema.permissions.sql



More information about the open-ils-commits mailing list