gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -move everything into schema


From: gnunet
Subject: [taler-exchange] branch master updated: -move everything into schema
Date: Mon, 25 Jul 2022 20:18:12 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 6d2e6d80 -move everything into schema
6d2e6d80 is described below

commit 6d2e6d80613e6f45d207f89bc25f6f507a131504
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Mon Jul 25 20:18:08 2022 +0200

    -move everything into schema
---
 src/exchangedb/common-0001.sql              |  7 +++++++
 src/exchangedb/drop.sql                     |  5 +----
 src/exchangedb/plugin_exchangedb_postgres.c | 28 +++++++++++++++++++++++-----
 src/exchangedb/procedures.sql               |  2 ++
 4 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/src/exchangedb/common-0001.sql b/src/exchangedb/common-0001.sql
index 5ae67edd..6c4a6024 100644
--- a/src/exchangedb/common-0001.sql
+++ b/src/exchangedb/common-0001.sql
@@ -17,6 +17,13 @@
 -- Everything in one big transaction
 BEGIN;
 
+-------------------- Schema ----------------------------
+
+CREATE SCHEMA exchange;
+COMMENT ON SCHEMA exchange IS 'taler-exchange data';
+
+SET search_path TO exchange;
+
 -------------------- Tables ----------------------------
 
 CREATE OR REPLACE FUNCTION create_partitioned_table(
diff --git a/src/exchangedb/drop.sql b/src/exchangedb/drop.sql
index d98f4bd2..4a4dafb1 100644
--- a/src/exchangedb/drop.sql
+++ b/src/exchangedb/drop.sql
@@ -20,9 +20,6 @@ BEGIN;
 
 SELECT _v.unregister_patch('exchange-0001');
 
-DROP SCHEMA public CASCADE;
-CREATE SCHEMA public;
-GRANT ALL ON SCHEMA public TO postgres;
-COMMENT ON SCHEMA public IS 'standard public schema';
+DROP SCHEMA exchange CASCADE;
 
 COMMIT;
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 127a4104..9fb9192c 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -222,6 +222,11 @@ postgres_create_shard_tables (void *cls,
     GNUNET_PQ_query_param_uint32 (&idx),
     GNUNET_PQ_query_param_end
   };
+  struct GNUNET_PQ_ExecuteStatement es[] = {
+    GNUNET_PQ_make_try_execute ("SET search_path TO exchange;"),
+    GNUNET_PQ_EXECUTE_STATEMENT_END
+  };
+
   struct GNUNET_PQ_PreparedStatement ps[] = {
     GNUNET_PQ_make_prepare ("create_shard_tables",
                             "SELECT"
@@ -234,7 +239,7 @@ postgres_create_shard_tables (void *cls,
   conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
                                      "exchangedb-postgres",
                                      "shard-",
-                                     NULL,
+                                     es,
                                      ps);
   if (NULL == conn)
     return GNUNET_SYSERR;
@@ -273,11 +278,15 @@ postgres_setup_partitions (void *cls,
                             1),
     GNUNET_PQ_PREPARED_STATEMENT_END
   };
+  struct GNUNET_PQ_ExecuteStatement es[] = {
+    GNUNET_PQ_make_try_execute ("SET search_path TO exchange;"),
+    GNUNET_PQ_EXECUTE_STATEMENT_END
+  };
 
   conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
                                      "exchangedb-postgres",
                                      NULL,
-                                     NULL,
+                                     es,
                                      ps);
   if (NULL == conn)
     return GNUNET_SYSERR;
@@ -353,7 +362,10 @@ postgres_setup_foreign_servers (void *cls,
     GNUNET_PQ_query_param_string (remote_user_pw),
     GNUNET_PQ_query_param_end
   };
-
+  struct GNUNET_PQ_ExecuteStatement es[] = {
+    GNUNET_PQ_make_try_execute ("SET search_path TO exchange;"),
+    GNUNET_PQ_EXECUTE_STATEMENT_END
+  };
   struct GNUNET_PQ_PreparedStatement ps[] = {
     GNUNET_PQ_make_prepare ("create_foreign_servers",
                             "SELECT"
@@ -366,7 +378,7 @@ postgres_setup_foreign_servers (void *cls,
   conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
                                      "exchangedb-postgres",
                                      NULL,
-                                     NULL,
+                                     es,
                                      ps);
   if (NULL == conn)
   {
@@ -4455,6 +4467,7 @@ internal_setup (struct PostgresClosure *pg,
         "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL 
SERIALIZABLE;"),
       GNUNET_PQ_make_try_execute ("SET enable_sort=OFF;"),
       GNUNET_PQ_make_try_execute ("SET enable_seqscan=OFF;"),
+      GNUNET_PQ_make_try_execute ("SET search_path TO exchange;"),
       GNUNET_PQ_EXECUTE_STATEMENT_END
     };
 #else
@@ -4464,6 +4477,7 @@ internal_setup (struct PostgresClosure *pg,
       GNUNET_PQ_make_try_execute ("SET enable_sort=OFF;"),
       GNUNET_PQ_make_try_execute ("SET enable_seqscan=OFF;"),
       GNUNET_PQ_make_try_execute ("SET autocommit=OFF;"),
+      GNUNET_PQ_make_try_execute ("SET search_path TO exchange;"),
       GNUNET_PQ_EXECUTE_STATEMENT_END
     };
 #endif
@@ -10501,6 +10515,10 @@ postgres_gc (void *cls)
       GNUNET_TIME_UNIT_YEARS,
       10));
   {
+    struct GNUNET_PQ_ExecuteStatement es[] = {
+      GNUNET_PQ_make_try_execute ("SET search_path TO exchange;"),
+      GNUNET_PQ_EXECUTE_STATEMENT_END
+    };
     struct GNUNET_PQ_PreparedStatement ps[] = {
       /* Used in #postgres_gc() */
       GNUNET_PQ_make_prepare ("run_gc",
@@ -10514,7 +10532,7 @@ postgres_gc (void *cls)
     conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
                                        "exchangedb-postgres",
                                        NULL,
-                                       NULL,
+                                       es,
                                        ps);
   }
   if (NULL == conn)
diff --git a/src/exchangedb/procedures.sql b/src/exchangedb/procedures.sql
index e2e7c75c..93685f4f 100644
--- a/src/exchangedb/procedures.sql
+++ b/src/exchangedb/procedures.sql
@@ -17,6 +17,8 @@
 -- Everything in one big transaction
 BEGIN;
 
+SET search_path TO exchange;
+
 ---------------------------------------------------------------------------
 --                      Stored procedures
 ---------------------------------------------------------------------------

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]