diff options
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 3c3eb7a6..8d4db04b 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -6220,7 +6220,12 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) " FROM merchant_instances" " WHERE merchant_id=$1)" " AND merchant_orders.order_id=$2" - " AND pay_deadline < $3", + " AND" + " ((NOT EXISTS" + " (SELECT order_id" + " FROM merchant_contract_terms" + " WHERE merchant_contract_terms.order_id=$2))" + " OR pay_deadline < $3)", 3), /* for postgres_lookup_order() */ GNUNET_PQ_make_prepare ("lookup_order", |