r16216 - gnucash/trunk - Add Klaus Dahlke's datafile -> sql-insert-statement scripts.

Josh Sled jsled at cvs.gnucash.org
Tue Jun 26 18:52:45 EDT 2007


Author: jsled
Date: 2007-06-26 18:52:43 -0400 (Tue, 26 Jun 2007)
New Revision: 16216
Trac: http://svn.gnucash.org/trac/changeset/16216

Added:
   gnucash/trunk/contrib/
   gnucash/trunk/contrib/pgsql-1.8-import/
   gnucash/trunk/contrib/pgsql-1.8-import/README
   gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql.pl
   gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql_update.pl
   gnucash/trunk/contrib/pgsql-1.8-import/gnctables.sql
Log:
Add Klaus Dahlke's datafile -> sql-insert-statement scripts.


Added: gnucash/trunk/contrib/pgsql-1.8-import/README
===================================================================
--- gnucash/trunk/contrib/pgsql-1.8-import/README	2007-06-26 18:43:16 UTC (rev 16215)
+++ gnucash/trunk/contrib/pgsql-1.8-import/README	2007-06-26 22:52:43 UTC (rev 16216)
@@ -0,0 +1,19 @@
+[jsled, 2007-06-26:]
+
+Contributed scripts from Klaus Dahlke <klaus.dahlke at gmx.de> to generate a set
+of SQL statements effectively importing a 2.0.5-format datafile into the
+(Postgres) sql schema for gnucash-1.8.
+
+<http://lists.gnucash.org/pipermail/gnucash-user/2007-May/020473.html>
+
+From Kalus' contribution email, <http://lists.gnucash.org/pipermail/gnucash-user/2007-May/020477.html>:
+
+------------------------------------------------------------
+
+Hi all, please find attached three files:
+
+1) gnctables.sql: creates the old gnucash relevant tables in an existing database. Please set the user accordingly in the script first and please be aware that the new features like customers, scheduled transaction etc are not represented by the table structure. But for reporting purposes the table structure is good enough.
+
+2) gnc2sql.pl: script for initial data load. Please check line 35 for the proper file name for the gnucash zipped xml file, check line 68 for connecting to the database.
+
+3) gnc2sql_update.sql: script for delta load. Unfortunately, it has to read the entire xml-file, but posts only the transactions since last upload/delta-upload. As above check line 39 for the file where the date of last upload is stored, check line 49 for the gnucash-file and check line 81 for connecting to the database. This script doesn't create new accounts or new commodities as neither of the tables have a date filed. You have to do that 'by hand' by evaluating the accountguid of a split. My assumption is that having new accounts and new commodities is not so often that doing it manually is sufficient. If the delta upload fails for what reason ever, you may delete the content of all tables and just run the initial load script (gnc2sql.pl) again.

Added: gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql.pl
===================================================================
--- gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql.pl	2007-06-26 18:43:16 UTC (rev 16215)
+++ gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql.pl	2007-06-26 22:52:43 UTC (rev 16216)
@@ -0,0 +1,186 @@
+#!/usr/bin/perl
+###
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2,
+# as published by the Free Software Foundation.
+#
+# 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.
+#
+# copyright (C) 2007 Klaus Dahlke <klaus.dahlke at gmx.de>
+# ####
+use XML::SAX::Simple;
+use Data::Dumper;
+use Date::Manip;
+use DateTime;
+use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ;
+use DBI qw(neat);
+
+use strict ;
+use warnings ;
+
+my ($dbh, $rows);
+my ($accountguid, $parentguid, $bookguid, $accountname, $accountcode, $description, $act_type, $commodity, $version, $iguid);
+my ($cmdty_space, $cmdty_id, $cmdty_sep);
+my ($splitguid, $transguid, $memo, $action, $reconsiled, $date_reconsiled, $amount, $value, @split_count, $split_anz);
+my ($last_modified, $date_entered, $date_posted, $num, $currency, $quantity);
+my ($fullname, $namespace, $mnemonic, $code, $fraction);
+my ($priceguid, $price_time, $source, $price_type, $valuenum, $valuedenom, $curr_space, $curr_id, $price_value);
+my ($newdate);
+###
+# open gnc file and convert to hash
+###
+my $input = new IO::File "<konten.xac"
+        or die "Cannot open 'konten.xac': $!\n" ;
+my $buffer ;
+    gunzip $input => \$buffer 
+        or die "gunzip failed: $GunzipError\n";
+
+my $data = XMLin($buffer);
+
+
+###
+# some constants 
+###
+$bookguid = $data->{"gnc:book"}->{"book:id"}->{"content"};
+$version=$data->{"gnc:book"}->{"version"};
+$version=substr($version,0,1);
+$cmdty_sep= '::';
+$cmdty_sep= '::';
+my @com_count = @{$data->{"gnc:book"}->{"gnc:commodity"}};
+my @trn_count = @{$data->{"gnc:book"}->{"gnc:transaction"}};
+my @acc_count = @{$data->{"gnc:book"}->{"gnc:account"}};
+my @price_count = @{$data->{"gnc:book"}->{"gnc:pricedb"}->{price}};
+my $com_anz = @com_count;
+my $trn_anz = @trn_count;
+my $acc_anz = @acc_count;
+my $price_anz = @price_count;
+print "No. commodities, ",$com_anz, "\n";
+print "No. transactions, ",$trn_anz, "\n";
+print "No. accounts, ",$acc_anz, "\n";
+print "No. prices in db, ",$price_anz, "\n";
+
+###
+# connect to database
+###
+$dbh = DBI->connect("dbi:Pg:dbname=konten", "klaus", "");
+$rows = $dbh->do ("insert into gncbook (bookguid, book_open, version, iguid) values ('$bookguid', 'y', '$version', '0')");
+
+
+####
+# accounts
+####
+for (my $j=0; $j<$acc_anz; $j++){
+   $accountguid=$data->{"gnc:book"}->{"gnc:account"}->[$j]->{"act:id"}->{"content"}; 
+      if (exists($data->{"gnc:book"}->{"gnc:account"}->[$j]->{"act:parent"})) {
+         $parentguid = $data->{"gnc:book"}->{"gnc:account"}->[$j]->{"act:parent"}->{"content"};
+         }
+      else {
+            $parentguid='00000000000000000000000000000000';
+      }
+      $accountname=$data->{"gnc:book"}->{"gnc:account"}->[$j]->{"act:name"};
+      if (exists($data->{"gnc:book"}->{"gnc:account"}->[$j]->{"act:description"})) {
+         $description=$data->{"gnc:book"}->{"gnc:account"}->[$j]->{"act:description"};
+         $description=~ s/'/\\\'/g;
+         }
+      else {
+         $description=' ';
+      }
+      $act_type = $data->{"gnc:book"}->{"gnc:account"}->[$j]->{"act:type"};
+      $cmdty_space = $data->{"gnc:book"}->{"gnc:account"}->[$j]->{"act:commodity"}->{"cmdty:space"};
+      $cmdty_id = $data->{"gnc:book"}->{"gnc:account"}->[$j]->{"act:commodity"}->{"cmdty:id"};
+      $commodity="$cmdty_space$cmdty_sep$cmdty_id";
+      $iguid=$j+1;
+      # print "$accountguid, $parentguid, $accountname, $description, $act_type, $commodity, \n";
+      $rows = $dbh->do ("insert into gncaccount (accountguid, parentguid, bookguid, accountname, description, type, commodity, version, iguid) values ('$accountguid', '$parentguid', '$bookguid', '$accountname', '$description', '$act_type', '$commodity', '$version', '$iguid')");
+}
+
+
+
+####
+## commoditites
+#####
+for (my $i=0; $i<$com_anz; $i++){
+      $cmdty_space = $data->{"gnc:book"}->{"gnc:commodity"}->[$i]->{"cmdty:space"};
+      $cmdty_id = $data->{"gnc:book"}->{"gnc:commodity"}->[$i]->{"cmdty:id"};
+      $cmdty_sep= '::';
+      $commodity="$cmdty_space$cmdty_sep$cmdty_id";
+      $fullname = $data->{"gnc:book"}->{"gnc:commodity"}->[$i]->{"cmdty:name"};
+      $namespace = $cmdty_space;
+      $mnemonic = $cmdty_id;
+      $fraction= $data->{"gnc:book"}->{"gnc:commodity"}->[$i]->{"cmdty:fraction"};
+#       print "$commodity, $fullname, $fraction, \n";
+      $rows = $dbh->do ("insert into gnccommodity (commodity, fullname, namespace, mnemonic, fraction) values ('$commodity', '$fullname', '$namespace', '$mnemonic', '$fraction')");
+}
+
+
+
+###
+## pricedb
+###
+for (my $k=0; $k<$price_anz; $k++) {
+      $priceguid=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:id"}->{"content"};
+      $cmdty_space = $data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:commodity"}->{"cmdty:space"};
+      $cmdty_id = $data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:commodity"}->{"cmdty:id"};
+      $commodity="$cmdty_space$cmdty_sep$cmdty_id";
+      $curr_space = $data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:currency"}->{"cmdty:space"};
+      $curr_id = $data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:currency"}->{"cmdty:id"};
+      $currency="$curr_space$cmdty_sep$curr_id";
+      $price_type=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:type"};
+      $price_time=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:time"}->{"ts:date"};
+      $price_value=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:value"};
+      $source=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:source"};
+      $valuenum=substr($price_value,0, index($price_value,"/"));
+      $valuedenom=substr($price_value, index($price_value,"/")+1,);
+#      print "$commodity, $currency, $price_time, $valuenum, $valuedenom, \n";
+      $rows = $dbh->do ("insert into gncprice (priceguid, bookguid, commodity, currency, time, source, type, valuenum, valuedenom, version) values ('$priceguid', '$bookguid', '$commodity', '$currency', '$price_time', '$source', '$price_type', '$valuenum', '$valuedenom', '$version')");
+}
+
+
+
+###
+## transactions and splits
+###
+for (my $l=0; $l<$trn_anz; $l++) {
+   $transguid=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:id"}->{"content"};
+   $date_entered=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:date-entered"}->{"ts:date"};
+   $date_posted=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:date-posted"}->{"ts:date"};
+   if (exists($data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:num"})) {
+      $num=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:num"};
+      }
+   else {
+      $num = '';
+   }
+   $description=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:description"};
+   $description=~ s/'/\\\'/g;
+   $curr_space=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:currency"}->{"cmdty:space"};   
+   $curr_id=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:currency"}->{"cmdty:id"};   
+   $currency="$curr_space$cmdty_sep$curr_id";
+   # print "$transguid, $date_posted, $description, $currency, \n";
+   $rows = $dbh->do ("insert into gnctransaction (transguid, date_entered, date_posted, num, description, currency, version) values ('$transguid', '$date_entered', '$date_posted', '$num', '$description', '$currency', '$version')");
+   ###
+   # splits per transaction
+   ###
+  @split_count = @{$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}}; 
+  $split_anz = @split_count;
+  for (my $m=0; $m<$split_anz; $m++) {
+      $splitguid=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}->[$m]->{"split:id"}->{"content"};
+      $accountguid=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}->[$m]->{"split:account"}->{"content"};
+     $quantity=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}->[$m]->{"split:quantity"};
+     $quantity=substr($quantity,0, index($quantity,"/"));
+     $value=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}->[$m]->{"split:value"};
+     $value=substr($value,0, index($value,"/"));
+     # print "$splitguid, $quantity, $value, \n";
+     $rows = $dbh->do ("insert into gncsplit (splitguid, accountguid, transguid, amount, value) values ('$splitguid', '$accountguid', '$transguid', '$quantity', '$value')");
+     }
+}
+###
+# write date to file for updater script
+###
+my $rc  = $dbh->disconnect;
+my $new_date = ParseDate("today");
+open(WRITEFILE, ">last_sql.txt");
+print WRITEFILE $new_date;
+close(WRITEFILE);


Property changes on: gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql_update.pl
===================================================================
--- gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql_update.pl	2007-06-26 18:43:16 UTC (rev 16215)
+++ gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql_update.pl	2007-06-26 22:52:43 UTC (rev 16216)
@@ -0,0 +1,157 @@
+#!/usr/bin/perl
+###
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2,
+## as published by the Free Software Foundation.
+##
+## 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.
+##
+## copyright (C) 2007 Klaus Dahlke <klaus.dahlke at gmx.de>
+## ####
+
+use XML::SAX::Simple;
+use Data::Dumper;
+use Date::Manip;
+use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ;
+use DBI qw(neat);
+
+use strict ;
+use warnings ;
+
+my ($dbh, $rows);
+my ($accountguid, $parentguid, $bookguid, $accountname, $accountcode, $description, $act_type, $commodity, $version, $iguid);
+my ($cmdty_space, $cmdty_id, $cmdty_sep);
+my ($splitguid, $transguid, $memo, $action, $reconsiled, $date_reconsiled, $amount, $value, @split_count, $split_anz);
+my ($last_modified, $date_entered, $date_posted, $num, $currency, $quantity);
+my ($fullname, $namespace, $mnemonic, $code, $fraction);
+my ($priceguid, $price_time, $source, $price_type, $valuenum, $valuedenom, $curr_space, $curr_id, $price_value);
+my ($old_date, $last_post, $delta_days);
+my ($new_date);
+
+
+
+###
+# get last update to database
+###
+open(READFILE, "<last_sql.txt");
+$old_date=<READFILE>;
+close(READFILE);
+$last_post =  ParseDate($old_date);
+
+
+
+###
+# read gnc file and convert to internal hash
+###
+my $input = new IO::File "<konten.xac"
+        or die "Cannot open 'konten.xac': $!\n" ;
+my $buffer ;
+    gunzip $input => \$buffer 
+        or die "gunzip failed: $GunzipError\n";
+my $data = XMLin($buffer);
+
+
+
+###
+# few constant to be used
+###
+$bookguid = $data->{"gnc:book"}->{"book:id"}->{"content"};
+$version=$data->{"gnc:book"}->{"version"};
+$version=substr($version,0,1);
+$cmdty_sep= '::';
+my @com_count = @{$data->{"gnc:book"}->{"gnc:commodity"}};
+my @trn_count = @{$data->{"gnc:book"}->{"gnc:transaction"}};
+my @acc_count = @{$data->{"gnc:book"}->{"gnc:account"}};
+my @price_count = @{$data->{"gnc:book"}->{"gnc:pricedb"}->{price}};
+my $com_anz = @com_count;
+my $trn_anz = @trn_count;
+my $acc_anz = @acc_count;
+my $price_anz = @price_count;
+print "No. commodities, ",$com_anz, "\n";
+print "No. transactions, ",$trn_anz, "\n";
+print "No. accounts, ",$acc_anz, "\n";
+print "No. prices in db, ",$price_anz, "\n";
+
+###
+# connect to database
+###
+$dbh = DBI->connect("dbi:Pg:dbname=konten", "klaus", "");
+
+
+###
+## pricedb
+###
+for (my $k=0; $k<$price_anz; $k++) {
+      $priceguid=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:id"}->{"content"};
+      $cmdty_space = $data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:commodity"}->{"cmdty:space"};
+      $cmdty_id = $data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:commodity"}->{"cmdty:id"};
+      $commodity="$cmdty_space$cmdty_sep$cmdty_id";
+      $curr_space = $data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:currency"}->{"cmdty:space"};
+      $curr_id = $data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:currency"}->{"cmdty:id"};
+      $currency="$curr_space$cmdty_sep$curr_id";
+      $price_type=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:type"};
+      $price_time=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:time"}->{"ts:date"};
+      $price_value=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:value"};
+      $source=$data->{"gnc:book"}->{"gnc:pricedb"}->{"price"}->[$k]->{"price:source"};
+      $valuenum=substr($price_value,0, index($price_value,"/"));
+      $valuedenom=substr($price_value, index($price_value,"/")+1,);
+      $delta_days = Date_Cmp($last_post, $price_time);
+      if ($delta_days < 0){ 
+         $rows = $dbh->do ("insert into gncprice (priceguid, bookguid, commodity, currency, time, source, type, valuenum, valuedenom, version) values ('$priceguid', '$bookguid', '$commodity', '$currency', '$price_time', '$source', '$price_type', '$valuenum', '$valuedenom', '$version')");
+       }
+}
+###
+## transactions and splits
+###
+for (my $l=0; $l<$trn_anz; $l++) {
+   $transguid=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:id"}->{"content"};
+   $date_entered=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:date-entered"}->{"ts:date"};
+   $date_posted=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:date-posted"}->{"ts:date"};
+   if (exists($data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:num"})) {
+      $num=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:num"};
+      }
+   else {
+      $num = '';
+   }
+   $description=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:description"};
+   $description=~ s/'/\\\'/g;
+   $curr_space=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:currency"}->{"cmdty:space"};   
+   $curr_id=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:currency"}->{"cmdty:id"};   
+   $currency="$curr_space$cmdty_sep$curr_id";
+   $delta_days = Date_Cmp($last_post, $date_entered);
+   if ($delta_days < 0){
+      $rows = $dbh->do ("insert into gnctransaction (transguid, date_entered, date_posted, num, description, currency, version) values ('$transguid', '$date_entered', '$date_posted', '$num', '$description', '$currency', '$version')");
+##
+# splits per transaction
+##
+     @split_count = @{$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}}; 
+     $split_anz = @split_count;
+     for (my $m=0; $m<$split_anz; $m++) {
+        $splitguid=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}->[$m]->{"split:id"}->{"content"};
+        $accountguid=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}->[$m]->{"split:account"}->{"content"};
+        $quantity=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}->[$m]->{"split:quantity"};
+        $quantity=substr($quantity,0, index($quantity,"/"));
+        $value=$data->{"gnc:book"}->{"gnc:transaction"}->[$l]->{"trn:splits"}->{"trn:split"}->[$m]->{"split:value"};
+        $value=substr($value,0, index($value,"/"));
+        $rows = $dbh->do ("insert into gncsplit (splitguid, accountguid, transguid, amount, value) values ('$splitguid', '$accountguid', '$transguid', '$quantity', '$value')");
+     }
+   }
+}
+
+
+###
+# disconnect from database
+###
+my $rc  = $dbh->disconnect;
+
+
+###
+# write date/time to file to have the date of last update available
+###
+$new_date = ParseDate("today");
+open(WRITEFILE, ">last_sql.txt");
+print WRITEFILE $new_date;
+close(WRITEFILE);


Property changes on: gnucash/trunk/contrib/pgsql-1.8-import/gnc2sql_update.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: gnucash/trunk/contrib/pgsql-1.8-import/gnctables.sql
===================================================================
--- gnucash/trunk/contrib/pgsql-1.8-import/gnctables.sql	2007-06-26 18:43:16 UTC (rev 16215)
+++ gnucash/trunk/contrib/pgsql-1.8-import/gnctables.sql	2007-06-26 22:52:43 UTC (rev 16216)
@@ -0,0 +1,868 @@
+
+--
+-- PostgreSQL database dump
+--
+
+SET client_encoding = 'UNICODE';
+SET check_function_bodies = false;
+SET client_min_messages = warning;
+
+--
+-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
+--
+
+COMMENT ON SCHEMA public IS 'Standard public schema';
+
+
+SET search_path = public, pg_catalog;
+
+--
+-- Name: plpgsql_call_handler(); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
+    AS '$libdir/plpgsql', 'plpgsql_call_handler'
+    LANGUAGE c;
+
+
+ALTER FUNCTION public.plpgsql_call_handler() OWNER TO postgres;
+
+--
+-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
+--
+
+CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;
+
+
+SET default_tablespace = '';
+
+SET default_with_oids = true;
+
+--
+-- Name: gncsplit; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncsplit (
+    splitguid character(32) NOT NULL,
+    accountguid character(32) NOT NULL,
+    transguid character(32) NOT NULL,
+    memo text,
+    "action" text,
+    reconciled character(1) DEFAULT 'n'::bpchar,
+    date_reconciled timestamp with time zone,
+    amount bigint DEFAULT 0::bigint,
+    value bigint DEFAULT 0::bigint,
+    iguid integer DEFAULT 0
+);
+
+
+ALTER TABLE public.gncsplit OWNER TO klaus;
+
+--
+-- Name: gnchelperpramt(gncsplit); Type: FUNCTION; Schema: public; Owner: klaus
+--
+
+CREATE FUNCTION gnchelperpramt(gncsplit) RETURNS bigint
+    AS $_$SELECT abs($1 . amount * gncCommodity.fraction) 
+       FROM gncSplit, gncTransaction, gncCommodity 
+       WHERE 
+       $1 . transGuid = gncTransaction.transGuid AND 
+       gncTransaction.currency = gncCommodity.commodity$_$
+    LANGUAGE sql;
+
+
+ALTER FUNCTION public.gnchelperpramt(gncsplit) OWNER TO klaus;
+
+--
+-- Name: gnchelperprval(gncsplit); Type: FUNCTION; Schema: public; Owner: klaus
+--
+
+CREATE FUNCTION gnchelperprval(gncsplit) RETURNS bigint
+    AS $_$SELECT abs($1 . value * gncCommodity.fraction) 
+       FROM gncSplit, gncAccount, gncCommodity 
+       WHERE 
+       $1 . accountGuid = gncAccount.accountGuid AND 
+       gncAccount.commodity = gncCommodity.commodity$_$
+    LANGUAGE sql;
+
+
+ALTER FUNCTION public.gnchelperprval(gncsplit) OWNER TO klaus;
+
+--
+-- Name: gncsubtotalbalance(character, timestamp with time zone, timestamp with time zone); Type: FUNCTION; Schema: public; Owner: klaus
+--
+
+CREATE FUNCTION gncsubtotalbalance(character, timestamp with time zone, timestamp with time zone) RETURNS bigint
+    AS $_$SELECT INT8(sum(gncSplit.amount)) 
+        FROM gncSplit, gncTransaction 
+        WHERE 
+        gncSplit.accountGuid = $1 AND 
+        gncSplit.transGuid = gncTransaction.transGuid AND 
+        gncTransaction.date_posted BETWEEN $2 AND $3$_$
+    LANGUAGE sql;
+
+
+ALTER FUNCTION public.gncsubtotalbalance(character, timestamp with time zone, timestamp with time zone) OWNER TO klaus;
+
+--
+-- Name: gncsubtotalclearedbalance(character, timestamp with time zone, timestamp with time zone); Type: FUNCTION; Schema: public; Owner: klaus
+--
+
+CREATE FUNCTION gncsubtotalclearedbalance(character, timestamp with time zone, timestamp with time zone) RETURNS bigint
+    AS $_$SELECT INT8(sum(gncSplit.amount)) 
+        FROM gncSplit, gncTransaction 
+        WHERE 
+        gncSplit.accountGuid = $1 AND 
+        gncSplit.transGuid = gncTransaction.transGuid AND 
+        gncTransaction.date_posted BETWEEN $2 AND $3 AND 
+        gncSplit.reconciled <> 'n'$_$
+    LANGUAGE sql;
+
+
+ALTER FUNCTION public.gncsubtotalclearedbalance(character, timestamp with time zone, timestamp with time zone) OWNER TO klaus;
+
+--
+-- Name: gncsubtotalreconedbalance(character, timestamp with time zone, timestamp with time zone); Type: FUNCTION; Schema: public; Owner: klaus
+--
+
+CREATE FUNCTION gncsubtotalreconedbalance(character, timestamp with time zone, timestamp with time zone) RETURNS bigint
+    AS $_$SELECT INT8(sum(gncSplit.amount)) 
+        FROM gncSplit, gncTransaction 
+        WHERE 
+        gncSplit.accountGuid = $1 AND 
+        gncSplit.transGuid = gncTransaction.transGuid AND 
+        gncTransaction.date_posted BETWEEN $2 AND $3 AND 
+        (gncSplit.reconciled = 'y' OR 
+         gncSplit.reconciled = 'f')$_$
+    LANGUAGE sql;
+
+
+ALTER FUNCTION public.gncsubtotalreconedbalance(character, timestamp with time zone, timestamp with time zone) OWNER TO klaus;
+
+--
+-- Name: gnc_iguid_seq; Type: SEQUENCE; Schema: public; Owner: klaus
+--
+
+CREATE SEQUENCE gnc_iguid_seq
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+
+
+ALTER TABLE public.gnc_iguid_seq OWNER TO klaus;
+
+--
+-- Name: gncaccount; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncaccount (
+    accountguid character(32) NOT NULL,
+    parentguid character(32) NOT NULL,
+    bookguid character(32) NOT NULL,
+    accountname text NOT NULL,
+    accountcode text,
+    description text,
+    "type" text NOT NULL,
+    commodity text NOT NULL,
+    version integer NOT NULL,
+    iguid integer DEFAULT 0,
+    CONSTRAINT gncaccount_accountname_check CHECK ((accountname <> ''::text)),
+    CONSTRAINT gncaccount_commodity_check CHECK ((commodity <> ''::text))
+);
+
+
+ALTER TABLE public.gncaccount OWNER TO klaus;
+
+--
+-- Name: gncaudittrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncaudittrail (
+    sessionguid character(32) NOT NULL,
+    date_changed timestamp with time zone,
+    change character(1) NOT NULL,
+    objtype character(1) NOT NULL
+);
+
+
+ALTER TABLE public.gncaudittrail OWNER TO klaus;
+
+--
+-- Name: gncaccounttrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncaccounttrail (
+    accountguid character(32) NOT NULL,
+    parentguid character(32) NOT NULL,
+    bookguid character(32) NOT NULL,
+    accountname text NOT NULL,
+    accountcode text,
+    description text,
+    "type" text NOT NULL,
+    commodity text NOT NULL,
+    version integer NOT NULL,
+    iguid integer DEFAULT 0,
+    CONSTRAINT gncaccounttrail_accountname_check CHECK ((accountname <> ''::text)),
+    CONSTRAINT gncaccounttrail_commodity_check CHECK ((commodity <> ''::text))
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gncaccounttrail OWNER TO klaus;
+
+--
+-- Name: gncbook; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncbook (
+    bookguid character(32) NOT NULL,
+    book_open character(1) DEFAULT 'n'::bpchar,
+    version integer NOT NULL,
+    iguid integer DEFAULT 0
+);
+
+
+ALTER TABLE public.gncbook OWNER TO klaus;
+
+--
+-- Name: gncbooktrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncbooktrail (
+    bookguid character(32) NOT NULL,
+    book_open character(1) DEFAULT 'n'::bpchar,
+    version integer NOT NULL,
+    iguid integer DEFAULT 0
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gncbooktrail OWNER TO klaus;
+
+--
+-- Name: gnccheckpoint; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnccheckpoint (
+    accountguid character(32) NOT NULL,
+    date_start timestamp with time zone NOT NULL,
+    date_end timestamp with time zone NOT NULL,
+    commodity text NOT NULL,
+    "type" text DEFAULT 'simple'::text,
+    balance bigint DEFAULT 0::bigint,
+    cleared_balance bigint DEFAULT 0::bigint,
+    reconciled_balance bigint DEFAULT 0::bigint,
+    CONSTRAINT gnccheckpoint_commodity_check CHECK ((commodity <> ''::text))
+);
+
+
+ALTER TABLE public.gnccheckpoint OWNER TO klaus;
+
+--
+-- Name: gnccommodity; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnccommodity (
+    commodity text NOT NULL,
+    fullname text,
+    namespace text NOT NULL,
+    mnemonic text NOT NULL,
+    code text,
+    fraction integer DEFAULT 100
+);
+
+
+ALTER TABLE public.gnccommodity OWNER TO klaus;
+
+--
+-- Name: gnccommoditytrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnccommoditytrail (
+    commodity text NOT NULL,
+    fullname text,
+    namespace text NOT NULL,
+    mnemonic text NOT NULL,
+    code text,
+    fraction integer DEFAULT 100
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnccommoditytrail OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue (
+    iguid integer NOT NULL,
+    ipath integer NOT NULL,
+    "type" character(4)
+);
+
+
+ALTER TABLE public.gnckvpvalue OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_dbl; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_dbl (
+    data double precision
+)
+INHERITS (gnckvpvalue);
+
+
+ALTER TABLE public.gnckvpvalue_dbl OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_dbltrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_dbltrail (
+    iguid integer,
+    ipath integer,
+    "type" character(4),
+    data double precision
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnckvpvalue_dbltrail OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_guid; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_guid (
+    data character(32)
+)
+INHERITS (gnckvpvalue);
+
+
+ALTER TABLE public.gnckvpvalue_guid OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_guidtrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_guidtrail (
+    iguid integer,
+    ipath integer,
+    "type" character(4),
+    data character(32)
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnckvpvalue_guidtrail OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_int64; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_int64 (
+    data bigint
+)
+INHERITS (gnckvpvalue);
+
+
+ALTER TABLE public.gnckvpvalue_int64 OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_int64trail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_int64trail (
+    iguid integer,
+    ipath integer,
+    "type" character(4),
+    data bigint
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnckvpvalue_int64trail OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_list; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_list (
+    data text[]
+)
+INHERITS (gnckvpvalue);
+
+
+ALTER TABLE public.gnckvpvalue_list OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_listtrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_listtrail (
+    iguid integer,
+    ipath integer,
+    "type" character(4),
+    data text[]
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnckvpvalue_listtrail OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_numeric; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_numeric (
+    num bigint,
+    denom bigint
+)
+INHERITS (gnckvpvalue);
+
+
+ALTER TABLE public.gnckvpvalue_numeric OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_numerictrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_numerictrail (
+    iguid integer,
+    ipath integer,
+    "type" character(4),
+    num bigint,
+    denom bigint
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnckvpvalue_numerictrail OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_str; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_str (
+    data text
+)
+INHERITS (gnckvpvalue);
+
+
+ALTER TABLE public.gnckvpvalue_str OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_strtrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_strtrail (
+    iguid integer,
+    ipath integer,
+    "type" character(4),
+    data text
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnckvpvalue_strtrail OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_timespec; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_timespec (
+    data timestamp with time zone
+)
+INHERITS (gnckvpvalue);
+
+
+ALTER TABLE public.gnckvpvalue_timespec OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_timespectrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvalue_timespectrail (
+    iguid integer,
+    ipath integer,
+    "type" character(4),
+    data timestamp with time zone
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnckvpvalue_timespectrail OWNER TO klaus;
+
+--
+-- Name: gnckvpvaluetrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnckvpvaluetrail (
+    iguid integer,
+    ipath integer,
+    "type" character(4)
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnckvpvaluetrail OWNER TO klaus;
+
+--
+-- Name: gncpathcache; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncpathcache (
+    ipath serial NOT NULL,
+    path text
+);
+
+
+ALTER TABLE public.gncpathcache OWNER TO klaus;
+
+--
+-- Name: gncprice; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncprice (
+    priceguid character(32) NOT NULL,
+    bookguid character(32) NOT NULL,
+    commodity text NOT NULL,
+    currency text NOT NULL,
+    "time" timestamp with time zone,
+    source text,
+    "type" text,
+    valuenum bigint DEFAULT 0::bigint,
+    valuedenom integer DEFAULT 100,
+    version integer NOT NULL,
+    CONSTRAINT gncprice_commodity_check CHECK ((commodity <> ''::text)),
+    CONSTRAINT gncprice_commodity_check1 CHECK ((commodity <> ''::text))
+);
+
+
+ALTER TABLE public.gncprice OWNER TO klaus;
+
+--
+-- Name: gncpricetrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncpricetrail (
+    priceguid character(32) NOT NULL,
+    bookguid character(32) NOT NULL,
+    commodity text NOT NULL,
+    currency text NOT NULL,
+    "time" timestamp with time zone,
+    source text,
+    "type" text,
+    valuenum bigint DEFAULT 0::bigint,
+    valuedenom integer DEFAULT 100,
+    version integer NOT NULL,
+    CONSTRAINT gncpricetrail_commodity_check CHECK ((commodity <> ''::text)),
+    CONSTRAINT gncpricetrail_commodity_check1 CHECK ((commodity <> ''::text))
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gncpricetrail OWNER TO klaus;
+
+--
+-- Name: gncsession; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncsession (
+    sessionguid character(32) NOT NULL,
+    session_mode character(16) NOT NULL,
+    hostname text,
+    login_name text,
+    gecos text,
+    time_on timestamp with time zone NOT NULL,
+    time_off timestamp with time zone DEFAULT 'infinity'::timestamp with time zone NOT NULL
+);
+
+
+ALTER TABLE public.gncsession OWNER TO klaus;
+
+--
+-- Name: gncsplittrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncsplittrail (
+    splitguid character(32) NOT NULL,
+    accountguid character(32) NOT NULL,
+    transguid character(32) NOT NULL,
+    memo text,
+    "action" text,
+    reconciled character(1) DEFAULT 'n'::bpchar,
+    date_reconciled timestamp with time zone,
+    amount bigint DEFAULT 0::bigint,
+    value bigint DEFAULT 0::bigint,
+    iguid integer DEFAULT 0
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gncsplittrail OWNER TO klaus;
+
+--
+-- Name: gnctransaction; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnctransaction (
+    transguid character(32) NOT NULL,
+    last_modified timestamp with time zone DEFAULT '2005-12-28 23:53:57.607072+01'::timestamp with time zone,
+    date_entered timestamp with time zone,
+    date_posted timestamp with time zone,
+    num text,
+    description text,
+    currency text NOT NULL,
+    version integer NOT NULL,
+    iguid integer DEFAULT 0,
+    CONSTRAINT gnctransaction_currency_check CHECK ((currency <> ''::text))
+);
+
+
+ALTER TABLE public.gnctransaction OWNER TO klaus;
+
+--
+-- Name: gnctransactiontrail; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gnctransactiontrail (
+    transguid character(32) NOT NULL,
+    last_modified timestamp with time zone DEFAULT '2005-12-28 23:53:57.700436+01'::timestamp with time zone,
+    date_entered timestamp with time zone,
+    date_posted timestamp with time zone,
+    num text,
+    description text,
+    currency text NOT NULL,
+    version integer NOT NULL,
+    iguid integer DEFAULT 0,
+    CONSTRAINT gnctransactiontrail_currency_check CHECK ((currency <> ''::text))
+)
+INHERITS (gncaudittrail);
+
+
+ALTER TABLE public.gnctransactiontrail OWNER TO klaus;
+
+--
+-- Name: gncversion; Type: TABLE; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE TABLE gncversion (
+    major integer NOT NULL,
+    minor integer NOT NULL,
+    rev integer DEFAULT 0,
+    name text NOT NULL,
+    date timestamp with time zone DEFAULT '2005-12-28 23:53:57.607072+01'::timestamp with time zone,
+    CONSTRAINT gncversion_name_check CHECK ((name <> ''::text))
+);
+
+
+ALTER TABLE public.gncversion OWNER TO klaus;
+
+--
+-- Name: gncaccount_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gncaccount
+    ADD CONSTRAINT gncaccount_pkey PRIMARY KEY (accountguid);
+
+
+ALTER INDEX public.gncaccount_pkey OWNER TO klaus;
+
+--
+-- Name: gncbook_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gncbook
+    ADD CONSTRAINT gncbook_pkey PRIMARY KEY (bookguid);
+
+
+ALTER INDEX public.gncbook_pkey OWNER TO klaus;
+
+--
+-- Name: gnccheckpoint_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gnccheckpoint
+    ADD CONSTRAINT gnccheckpoint_pkey PRIMARY KEY (accountguid, date_start, commodity);
+
+
+ALTER INDEX public.gnccheckpoint_pkey OWNER TO klaus;
+
+--
+-- Name: gnccommodity_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gnccommodity
+    ADD CONSTRAINT gnccommodity_pkey PRIMARY KEY (commodity);
+
+
+ALTER INDEX public.gnccommodity_pkey OWNER TO klaus;
+
+--
+-- Name: gnckvpvalue_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gnckvpvalue
+    ADD CONSTRAINT gnckvpvalue_pkey PRIMARY KEY (iguid, ipath);
+
+
+ALTER INDEX public.gnckvpvalue_pkey OWNER TO klaus;
+
+--
+-- Name: gncpathcache_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gncpathcache
+    ADD CONSTRAINT gncpathcache_pkey PRIMARY KEY (ipath);
+
+
+ALTER INDEX public.gncpathcache_pkey OWNER TO klaus;
+
+--
+-- Name: gncprice_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gncprice
+    ADD CONSTRAINT gncprice_pkey PRIMARY KEY (priceguid);
+
+
+ALTER INDEX public.gncprice_pkey OWNER TO klaus;
+
+--
+-- Name: gncsession_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gncsession
+    ADD CONSTRAINT gncsession_pkey PRIMARY KEY (sessionguid);
+
+
+ALTER INDEX public.gncsession_pkey OWNER TO klaus;
+
+--
+-- Name: gncsplit_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gncsplit
+    ADD CONSTRAINT gncsplit_pkey PRIMARY KEY (splitguid);
+
+
+ALTER INDEX public.gncsplit_pkey OWNER TO klaus;
+
+--
+-- Name: gnctransaction_pkey; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gnctransaction
+    ADD CONSTRAINT gnctransaction_pkey PRIMARY KEY (transguid);
+
+
+ALTER INDEX public.gnctransaction_pkey OWNER TO klaus;
+
+--
+-- Name: gncversion_name_key; Type: CONSTRAINT; Schema: public; Owner: klaus; Tablespace: 
+--
+
+ALTER TABLE ONLY gncversion
+    ADD CONSTRAINT gncversion_name_key UNIQUE (name);
+
+
+ALTER INDEX public.gncversion_name_key OWNER TO klaus;
+
+--
+-- Name: gncaccounttrail_account_idx; Type: INDEX; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE INDEX gncaccounttrail_account_idx ON gncaccounttrail USING btree (accountguid);
+
+
+ALTER INDEX public.gncaccounttrail_account_idx OWNER TO klaus;
+
+--
+-- Name: gncbooktrail_book_idx; Type: INDEX; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE INDEX gncbooktrail_book_idx ON gncbooktrail USING btree (bookguid);
+
+
+ALTER INDEX public.gncbooktrail_book_idx OWNER TO klaus;
+
+--
+-- Name: gnccommoditytrail_commodity_idx; Type: INDEX; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE INDEX gnccommoditytrail_commodity_idx ON gnccommoditytrail USING btree (commodity);
+
+
+ALTER INDEX public.gnccommoditytrail_commodity_idx OWNER TO klaus;
+
+--
+-- Name: gncpricetrail_price_idx; Type: INDEX; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE INDEX gncpricetrail_price_idx ON gncpricetrail USING btree (priceguid);
+
+
+ALTER INDEX public.gncpricetrail_price_idx OWNER TO klaus;
+
+--
+-- Name: gncsplit_acc_idx; Type: INDEX; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE INDEX gncsplit_acc_idx ON gncsplit USING btree (accountguid);
+
+
+ALTER INDEX public.gncsplit_acc_idx OWNER TO klaus;
+
+--
+-- Name: gncsplit_trn_idx; Type: INDEX; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE INDEX gncsplit_trn_idx ON gncsplit USING btree (transguid);
+
+
+ALTER INDEX public.gncsplit_trn_idx OWNER TO klaus;
+
+--
+-- Name: gncsplittrail_split_idx; Type: INDEX; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE INDEX gncsplittrail_split_idx ON gncsplittrail USING btree (splitguid);
+
+
+ALTER INDEX public.gncsplittrail_split_idx OWNER TO klaus;
+
+--
+-- Name: gnctransaction_posted_idx; Type: INDEX; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE INDEX gnctransaction_posted_idx ON gnctransaction USING btree (date_posted);
+
+
+ALTER INDEX public.gnctransaction_posted_idx OWNER TO klaus;
+
+--
+-- Name: gnctransactiontrail_trans_idx; Type: INDEX; Schema: public; Owner: klaus; Tablespace: 
+--
+
+CREATE INDEX gnctransactiontrail_trans_idx ON gnctransactiontrail USING btree (transguid);
+
+
+ALTER INDEX public.gnctransactiontrail_trans_idx OWNER TO klaus;
+
+--
+-- Name: public; Type: ACL; Schema: -; Owner: postgres
+--
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM postgres;
+GRANT ALL ON SCHEMA public TO postgres;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+
+
+--
+-- PostgreSQL database dump complete
+--



More information about the gnucash-changes mailing list