JBAS-255 updated production schema export
authorBill Erickson <berickxx@gmail.com>
Thu, 8 Jan 2015 16:12:32 +0000 (08:12 -0800)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/sql/dev-data/kcls-eg-db-schema.sql

index f6c86db..056c9c1 100644 (file)
@@ -1,23 +1,22 @@
---
--- PostgreSQL database dump
---
 
-/*
-Generated 2014-12-22
-pg_dump -U evergreen evergreen -s > kcls-eg-db-schema.sql
-*/
 
--- These may already exist.  
-CREATE USER bbonner; -- custom                                                 
-CREATE USER biblio;  -- custom                                                 
-CREATE USER kclsreporter; -- custom                                            
-CREATE USER kclsreporter2; -- custom                                           
+-- Generated 2015-01-08 08:09:42 on db03.eg.kcls.org
+
+-- These custom users may already exist... errors are OK.
+
+CREATE USER bbonner;
+CREATE USER biblio;
+CREATE USER kclsreporter;
+CREATE USER kclsreporter2;
 
 BEGIN;
 
-\set ON_ERROR_STOP on;                                                         
+\set ON_ERROR_STOP on                                                         
+
 
--- PGDUMP output begins here...
+--
+-- PostgreSQL database dump
+--
 
 SET statement_timeout = 0;
 SET client_encoding = 'UTF8';
@@ -640,6 +639,7 @@ CREATE EXTENSION IF NOT EXISTS pg_buffercache WITH SCHEMA evergreen;
 
 COMMENT ON EXTENSION pg_buffercache IS 'examine the shared buffer cache';
 
+
 /*
 --
 -- Name: pg_prewarm; Type: EXTENSION; Schema: -; Owner: 
@@ -12039,7 +12039,7 @@ $_$;
 ALTER FUNCTION collectionhq.write_bib_rows_to_stdout(text, integer) OWNER TO evergreen;
 
 --
--- Name: write_item_rows_to_stdout(text, integer); Type: FUNCTION; Schema: collectionhq; Owner: evergreen
+-- Name: write_item_rows_to_stdout(text, integer); Type: FUNCTION; Schema: collectionhq; Owner: postgres
 --
 
 CREATE FUNCTION write_item_rows_to_stdout(text, integer) RETURNS text
@@ -12081,7 +12081,7 @@ CREATE FUNCTION write_item_rows_to_stdout(text, integer) RETURNS text
 
     SELECT REPLACE(NOW()::DATE::TEXT, '-', '') INTO extract_date;
     FOR item, arrived, cumulative_use_total IN
-      SELECT cp.id, dest_recv_time, COALESCE(sum(c.circ_count), 0::bigint) + COALESCE(count(circ.id), 0::bigint) + COALESCE(count(acirc.id), 0::bigint) AS circ_count
+      SELECT cp.id, dest_recv_time, COALESCE(sum(DISTINCT c.circ_count), 0::bigint) + COALESCE(count(DISTINCT circ.id), 0::bigint) + COALESCE(count(DISTINCT acirc.id), 0::bigint) AS circ_count
       FROM asset.copy cp
       LEFT JOIN extend_reporter.legacy_circ_count c USING (id)
       LEFT JOIN (SELECT max(dest_recv_time) as dest_recv_time, target_copy, dest from action.transit_copy group by target_copy, dest) atc ON (cp.id = atc.target_copy AND cp.circ_lib = atc.dest)
@@ -12162,13 +12162,12 @@ CREATE FUNCTION write_item_rows_to_stdout(text, integer) RETURNS text
 
     RAISE INFO '% rows written in total.', num_rows;
     RETURN '';
-
   END;
 
 $_$;
 
 
-ALTER FUNCTION collectionhq.write_item_rows_to_stdout(text, integer) OWNER TO evergreen;
+ALTER FUNCTION collectionhq.write_item_rows_to_stdout(text, integer) OWNER TO postgres;
 
 --
 -- Name: write_item_rows_to_stdout_new(text, integer); Type: FUNCTION; Schema: collectionhq; Owner: postgres
@@ -107073,4 +107072,6 @@ GRANT USAGE ON SEQUENCE queued_record_id_seq TO bbonner;
 -- PostgreSQL database dump complete
 --
 
+
 COMMIT;
+