GnuCash
Contact   Instructions
Bug 796961 - Can't overwrite existing MYSQL database, V3.3.
Summary: Can't overwrite existing MYSQL database, V3.3.
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Backend - SQL (show other bugs)
Version: 3.3
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: core
QA Contact: core
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-01 09:41 EST by Colin Law
Modified: 2018-12-28 16:30 EST (History)
3 users (show)

See Also:


Attachments

Description Colin Law 2018-12-01 09:41:46 EST
Running GnuCash 3.3 on Ubuntu 18.10 from the Ubuntu repository (v3.3-2) if an attempt is made to Save As over an existing database the existing db is detected and deleted but the save then fails "The server at URL ... experienced an error or encountered bad or corrupt data."
This is a similar symptom to bug #796724.

In gnucash.trace I see
* 15:40:07  WARN <gnc.backend.dbi>
[GncDbiBackend<Type>::session_begin()] Databse already exists, Might
clobber it.
* 15:41:37  CRIT <gnc.backend.dbi>
[GncDbiBackend<Type>::session_begin()] Unable to create database
'gnucash'

With query log enabled in mysql, when I attempt to save I first see
2018-10-13T09:05:13.241000Z        5 Connect    root@localhost on gnucash using Socket
2018-10-13T09:05:13.241249Z        5 Query    SET NAMES 'utf8'
2018-10-13T09:05:13.241428Z        5 Query    SELECT @@sql_mode
2018-10-13T09:05:13.241746Z        5 Query    SET sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
2018-10-13T09:05:13.241903Z        5 Query    CREATE TEMPORARY TABLE numtest ( test_int BIGINT, test_unsigned BIGINT, test_double FLOAT8 )
2018-10-13T09:05:13.242534Z        5 Query    INSERT INTO numtest VALUES (-9223372036854775807, 9223372036854775807, 1.79769213486e+307)
2018-10-13T09:05:13.242779Z        5 Query    SELECT * FROM numtest
2018-10-13T09:05:13.243032Z        5 Query    DROP TABLE numtest
2018-10-13T09:05:13.243496Z        5 Query    SHOW TABLES FROM `gnucash`
2018-10-13T09:05:13.243955Z        5 Quit  

Then it shows the db already exists warning.  When I tell it to go ahead I see
2018-10-13T09:05:29.411367Z        6 Connect    root@localhost on gnucash using Socket
2018-10-13T09:05:29.411622Z        6 Query    SET NAMES 'utf8'
2018-10-13T09:05:29.411817Z        6 Query    SELECT @@sql_mode
2018-10-13T09:05:29.412095Z        6 Query    SET sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
2018-10-13T09:05:29.412250Z        6 Query    CREATE TEMPORARY TABLE numtest ( test_int BIGINT, test_unsigned BIGINT, test_double FLOAT8 )
2018-10-13T09:05:29.413159Z        6 Query    INSERT INTO numtest VALUES (-9223372036854775807, 9223372036854775807, 1.79769213486e+307)
2018-10-13T09:05:29.413459Z        6 Query    SELECT * FROM numtest
2018-10-13T09:05:29.413756Z        6 Query    DROP TABLE numtest
2018-10-13T09:05:29.414040Z        6 Query    SHOW TABLES FROM `gnucash`
2018-10-13T09:05:29.414333Z        6 Init DB    mysql
2018-10-13T09:05:29.414405Z        6 Query    DROP DATABASE `gnucash`
2018-10-13T09:05:33.727523Z        7 Connect    root@localhost on gnucash using Socket

and nothing else.  There is a few seconds gap after the drop database before the Connect line and the error message on screen.
Comment 1 John Ralls 2018-12-28 16:30:18 EST
The problem was that the flag indicating that the database exists wasn't reset after dropping the database so database creation didn't run.

Fixed in GnuCash 3.4.

Note You need to log in before you can comment on or make changes to this bug.