gnucash maint: Bug 794765 - when saving as into a PostgreSQL database, things fail because of renaming the numtest table twice

Geert Janssens gjanssens at code.gnucash.org
Thu Mar 29 13:06:31 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/157f43d9 (commit)
	from  https://github.com/Gnucash/gnucash/commit/55a2504c (commit)



commit 157f43d96328efae20d10739cbab660c999c709a
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Mar 29 19:04:16 2018 +0200

    Bug 794765 - when saving as into a PostgreSQL database, things fail because of renaming the numtest table twice

diff --git a/src/backend/dbi/gnc-backend-dbi.c b/src/backend/dbi/gnc-backend-dbi.c
index bfb50a0..5708f78 100644
--- a/src/backend/dbi/gnc-backend-dbi.c
+++ b/src/backend/dbi/gnc-backend-dbi.c
@@ -3326,7 +3326,8 @@ conn_test_dbi_library( dbi_conn conn )
     GncDbiTestResult retval = GNC_DBI_PASS;
     memset( doublestr, 0, sizeof(doublestr));
 
-    result = dbi_conn_query( conn, "CREATE TEMPORARY TABLE numtest "
+    result = dbi_conn_query( conn, "DROP TABLE IF EXISTS numtest;"
+                             "CREATE TEMPORARY TABLE numtest "
                              "( test_int BIGINT, test_unsigned BIGINT,"
                              " test_double FLOAT8 )" );
     if ( result == NULL )
@@ -3344,6 +3345,7 @@ conn_test_dbi_library( dbi_conn conn )
     if ( result == NULL )
     {
         PWARN("Test_DBI_Library: Failed to insert test row into table" );
+        result = dbi_conn_query( conn, "DROP TABLE numtest" );
         return GNC_DBI_FAIL_SETUP;
     }
     dbi_result_free( result );



Summary of changes:
 src/backend/dbi/gnc-backend-dbi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list