[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: adjust partition and primary key
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: adjust partition and primary keys commitments and reveals in withdraw-age |
Date: |
Wed, 11 Jan 2023 17:21:25 +0100 |
This is an automated email from the git hooks/post-receive script.
oec pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new eafe3435 adjust partition and primary keys commitments and reveals in
withdraw-age
eafe3435 is described below
commit eafe3435e99870d93c8b6adf457f4c4c9e050415
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Wed Jan 11 17:21:16 2023 +0100
adjust partition and primary keys commitments and reveals in withdraw-age
---
src/exchangedb/0003-withdraw_age_commitments.sql | 7 +++---
src/exchangedb/0003-withdraw_age_reveals.sql | 31 +++++++++++++++++++++++-
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/src/exchangedb/0003-withdraw_age_commitments.sql
b/src/exchangedb/0003-withdraw_age_commitments.sql
index f6f8b44d..1aac8bb2 100644
--- a/src/exchangedb/0003-withdraw_age_commitments.sql
+++ b/src/exchangedb/0003-withdraw_age_commitments.sql
@@ -36,7 +36,7 @@ BEGIN
',timestamp INT8 NOT NULL'
') %s ;'
,table_name
- ,'PARTITION BY HASH (h_commitment)'
+ ,'PARTITION BY HASH (reserve_pub)'
,partition_suffix
);
PERFORM comment_partitioned_table(
@@ -96,9 +96,8 @@ BEGIN
table_name = concat_ws('_', table_name, partition_suffix);
EXECUTE FORMAT (
- 'CREATE INDEX ' || table_name || '_by_reserve_pub'
- ' ON ' || table_name ||
- ' (reserve_pub);'
+ 'ALTER TABLE ' || table_name ||
+ ' ADD PRIMARY KEY (h_commitment, reserve_pub);'
);
EXECUTE FORMAT (
'ALTER TABLE ' || table_name ||
diff --git a/src/exchangedb/0003-withdraw_age_reveals.sql
b/src/exchangedb/0003-withdraw_age_reveals.sql
index 2279c647..3353d936 100644
--- a/src/exchangedb/0003-withdraw_age_reveals.sql
+++ b/src/exchangedb/0003-withdraw_age_reveals.sql
@@ -25,7 +25,8 @@ DECLARE
BEGIN
PERFORM create_partitioned_table(
'CREATE TABLE %I'
- '(h_commitment BYTEA NOT NULL CHECK (LENGTH(h_commitment)=32)'
+ '(withdraw_age_reveals_id BIGINT GENERATED BY DEFAULT AS IDENTITY' --
UNIQUE
+ ',h_commitment BYTEA NOT NULL CHECK (LENGTH(h_commitment)=32)'
',freshcoin_index INT4 NOT NULL'
',denominations_serial INT8 NOT NULL'
',h_coin_ev BYTEA CHECK (LENGTH(h_coin_ev)=32)'
@@ -66,6 +67,29 @@ BEGIN
END
$$;
+CREATE FUNCTION constrain_table_withdraw_age_reveals(
+ IN partition_suffix VARCHAR
+)
+RETURNS void
+LANGUAGE plpgsql
+AS $$
+DECLARE
+ table_name VARCHAR DEFAULT 'withdraw_age_reveals';
+BEGIN
+ table_name = concat_ws('_', table_name, partition_suffix);
+
+ EXECUTE FORMAT (
+ 'ALTER TABLE ' || table_name ||
+ ' ADD CONSTRAINT ' || table_name || '_withdraw_age_reveals_id_key'
+ ' UNIQUE (withdraw_age_reveals_id);'
+ );
+ EXECUTE FORMAT (
+ 'ALTER TABLE ' || table_name ||
+ ' ADD CONSTRAINT ' || table_name ||
'_freshcoin_index_and_h_commitment_uniqueness'
+ ' UNIQUE (freshcoin_index, h_commitment);'
+ );
+END
+$$;
CREATE FUNCTION foreign_table_withdraw_age_reveals()
RETURNS void
@@ -104,6 +128,11 @@ INSERT INTO exchange_tables
,FALSE),
('withdraw_age_reveals'
,'exchange-0003'
+ ,'constrain'
+ ,TRUE
+ ,FALSE),
+ ('withdraw_age_reveals'
+ ,'exchange-0003'
,'foreign'
,TRUE
,FALSE);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: adjust partition and primary keys commitments and reveals in withdraw-age,
gnunet <=