Can't overwrite gnucash DB on MariaDB 10.1.29. Error message: "The server at URL ... experienced an error or encountered bad or corrupt data." At version 3.0 all was allright. An 3.1 I'm not sure. Maybe is the same issue with 796698. https://bugs.gnucash.org/show_bug.cgi?id=796698
What was the error? There should be something in your MariaDB logs...
(In reply to John Ralls from comment #1) > What was the error? There should be something in your MariaDB logs... I don't see error in logs, but gnucahs try run this scrip (before question about overwrite and after, I think) (see below) I already have this tables, my versions table data is table_name table_version accounts 1 billterms 2 books 1 budgets 1 budget_amounts 1 commodities 1 customers 2 employees 2 entries 4 Gnucash 2 062 100 Gnucash-Resave 19 920 invoices 4 jobs 1 lots 2 orders 1 prices 3 recurrences 2 schedxactions 1 slots 4 splits 4 taxtables 2 taxtable_entries 3 transactions 4 vendors 1 SET NAMES 'utf8' SELECT @@sql_mode CREATE TEMPORARY TABLE numtest ( test_int BIGINT, test_unsigned BIGINT, test_double FLOAT8 ) INSERT INTO numtest VALUES (-9223372036854775807, 9223372036854775807, 1.79769213486e+307) SELECT * FROM numtest DROP TABLE numtest SHOW TABLES FROM `gnucash` SET NAMES 'utf8' SELECT @@sql_mode CREATE TEMPORARY TABLE numtest ( test_int BIGINT, test_unsigned BIGINT, test_double FLOAT8 ) INSERT INTO numtest VALUES (-9223372036854775807, 9223372036854775807, 1.79769213486e+307) SELECT * FROM numtest DROP TABLE numtest BEGIN SHOW TABLES FROM `gnucash` LIKE 'gnclock' SELECT * FROM gnclock INSERT INTO gnclock VALUES ('Infinity', '8376') COMMIT SHOW TABLES FROM `gnucash` LIKE '%back' CREATE TABLE versions(table_name varchar(50) CHARACTER SET utf8 PRIMARY KEY NOT NULL, table_version integer NOT NULL) INSERT INTO versions VALUES('Gnucash',3000002) INSERT INTO versions VALUES('Gnucash-Resave',19920) CREATE TABLE books(guid varchar(32) PRIMARY KEY NOT NULL, root_account_guid varchar(32) NOT NULL, root_template_guid varchar(32) NOT NULL) INSERT INTO versions VALUES('books',1) CREATE TABLE commodities(guid varchar(32) PRIMARY KEY NOT NULL, namespace varchar(2048) CHARACTER SET utf8 NOT NULL, mnemonic varchar(2048) CHARACTER SET utf8 NOT NULL, fullname varchar(2048) CHARACTER SET utf8, cusip varchar(2048) CHARACTER SET utf8, fraction integer NOT NULL, quote_flag integer NOT NULL, quote_source varchar(2048) CHARACTER SET utf8, quote_tz varchar(2048) CHARACTER SET utf8) INSERT INTO versions VALUES('commodities',1) CREATE TABLE accounts(guid varchar(32) PRIMARY KEY NOT NULL, name varchar(2048) CHARACTER SET utf8 NOT NULL, account_type varchar(2048) CHARACTER SET utf8 NOT NULL, commodity_guid varchar(32), commodity_scu integer NOT NULL, non_std_scu integer NOT NULL, parent_guid varchar(32), code varchar(2048) CHARACTER SET utf8, description varchar(2048) CHARACTER SET utf8, hidden integer, placeholder integer) INSERT INTO versions VALUES('accounts',1) CREATE TABLE budgets(guid varchar(32) PRIMARY KEY NOT NULL, name varchar(2048) CHARACTER SET utf8 NOT NULL, description varchar(2048) CHARACTER SET utf8, num_periods integer NOT NULL) INSERT INTO versions VALUES('budgets',1) CREATE TABLE budget_amounts(id integer PRIMARY KEY AUTO_INCREMENT NOT NULL, budget_guid varchar(32) NOT NULL, account_guid varchar(32) NOT NULL, period_num integer NOT NULL, amount_num bigint NOT NULL, amount_denom bigint NOT NULL) INSERT INTO versions VALUES('budget_amounts',1) CREATE TABLE prices(guid varchar(32) PRIMARY KEY NOT NULL, commodity_guid varchar(32) NOT NULL, currency_guid varchar(32) NOT NULL, date DATETIME NULL DEFAULT '1970-01-01 00:00:00' NOT NULL, source varchar(2048) CHARACTER SET utf8, type varchar(2048) CHARACTER SET utf8, value_num bigint NOT NULL, value_denom bigint NOT NULL) INSERT INTO versions VALUES('prices',3) CREATE TABLE transactions(guid varchar(32) PRIMARY KEY NOT NULL, currency_guid varchar(32) NOT NULL, num varchar(2048) CHARACTER SET utf8 NOT NULL, post_date DATETIME NULL DEFAULT '1970-01-01 00:00:00', enter_date DATETIME NULL DEFAULT '1970-01-01 00:00:00', description varchar(2048) CHARACTER SET utf8) INSERT INTO versions VALUES('transactions',4) CREATE INDEX tx_post_date_index ON transactions(post_date) CREATE TABLE splits(guid varchar(32) PRIMARY KEY NOT NULL, tx_guid varchar(32) NOT NULL, account_guid varchar(32) NOT NULL, memo varchar(2048) CHARACTER SET utf8 NOT NULL, action varchar(2048) CHARACTER SET utf8 NOT NULL, reconcile_state varchar(1) CHARACTER SET utf8 NOT NULL, reconcile_date DATETIME NULL DEFAULT '1970-01-01 00:00:00', value_num bigint NOT NULL, value_denom bigint NOT NULL, quantity_num bigint NOT NULL, quantity_denom bigint NOT NULL, lot_guid varchar(32)) INSERT INTO versions VALUES('splits',4) CREATE INDEX splits_tx_guid_index ON splits(tx_guid) CREATE INDEX splits_account_guid_index ON splits(account_guid) CREATE TABLE slots(id integer PRIMARY KEY AUTO_INCREMENT NOT NULL, obj_guid varchar(32) NOT NULL, name varchar(4096) CHARACTER SET utf8 NOT NULL, slot_type integer NOT NULL, int64_val bigint, string_val varchar(4096) CHARACTER SET utf8, double_val double, timespec_val DATETIME NULL DEFAULT '1970-01-01 00:00:00', guid_val varchar(32), numeric_val_num bigint, numeric_val_denom bigint, gdate_val date) INSERT INTO versions VALUES('slots',4) CREATE INDEX slots_guid_index ON slots(obj_guid) CREATE TABLE recurrences(id integer PRIMARY KEY AUTO_INCREMENT NOT NULL, obj_guid varchar(32) NOT NULL, recurrence_mult integer NOT NULL, recurrence_period_type varchar(2048) CHARACTER SET utf8 NOT NULL, recurrence_period_start date NOT NULL, recurrence_weekend_adjust varchar(2048) CHARACTER SET utf8 NOT NULL) INSERT INTO versions VALUES('recurrences',2) CREATE TABLE schedxactions(guid varchar(32) PRIMARY KEY NOT NULL, name varchar(2048) CHARACTER SET utf8, enabled integer NOT NULL, start_date date, end_date date, last_occur date, num_occur integer NOT NULL, rem_occur integer NOT NULL, auto_create integer NOT NULL, auto_notify integer NOT NULL, adv_creation integer NOT NULL, adv_notify integer NOT NULL, instance_count integer NOT NULL, template_act_guid varchar(32) NOT NULL) INSERT INTO versions VALUES('schedxactions',1) CREATE TABLE lots(guid varchar(32) PRIMARY KEY NOT NULL, account_guid varchar(32), is_closed integer NOT NULL) INSERT INTO versions VALUES('lots',2) CREATE TABLE billterms(guid varchar(32) PRIMARY KEY NOT NULL, name varchar(2048) CHARACTER SET utf8 NOT NULL, description varchar(2048) CHARACTER SET utf8 NOT NULL, refcount integer NOT NULL, invisible integer NOT NULL, parent varchar(32), type varchar(2048) CHARACTER SET utf8 NOT NULL, duedays integer, discountdays integer, discount_num bigint, discount_denom bigint, cutoff integer) INSERT INTO versions VALUES('billterms',2) CREATE TABLE customers(guid varchar(32) PRIMARY KEY NOT NULL, name varchar(2048) CHARACTER SET utf8 NOT NULL, id varchar(2048) CHARACTER SET utf8 NOT NULL, notes varchar(2048) CHARACTER SET utf8 NOT NULL, active integer NOT NULL, discount_num bigint NOT NULL, discount_denom bigint NOT NULL, credit_num bigint NOT NULL, credit_denom bigint NOT NULL, currency varchar(32) NOT NULL, tax_override integer NOT NULL, addr_name varchar(1024) CHARACTER SET utf8, addr_addr1 varchar(1024) CHARACTER SET utf8, addr_addr2 varchar(1024) CHARACTER SET utf8, addr_addr3 varchar(1024) CHARACTER SET utf8, addr_addr4 varchar(1024) CHARACTER SET utf8, addr_phone varchar(128) CHARACTER SET utf8, addr_fax varchar(128) CHARACTER SET utf8, addr_email varchar(256) CHARACTER SET utf8, shipaddr_name varchar(1024) CHARACTER SET utf8, shipaddr_addr1 varchar(1024) CHARACTER SET utf8, shipaddr_addr2 varchar(1024) CHARACTER SET utf8, shipaddr_addr3 varchar(1024) CHARACTER SET utf8, shipaddr_addr4 varchar(1024) CHARACTER SET utf8, shipaddr_phone varchar(128) CHARACTER SET utf8, shipaddr_fax varchar(128) CHARACTER SET utf8, shipaddr_email varchar(256) CHARACTER SET utf8, terms varchar(32), tax_included integer, taxtable varchar(32)) INSERT INTO versions VALUES('customers',2) CREATE TABLE employees(guid varchar(32) PRIMARY KEY NOT NULL, username varchar(2048) CHARACTER SET utf8 NOT NULL, id varchar(2048) CHARACTER SET utf8 NOT NULL, language varchar(2048) CHARACTER SET utf8 NOT NULL, acl varchar(2048) CHARACTER SET utf8 NOT NULL, active integer NOT NULL, currency varchar(32) NOT NULL, ccard_guid varchar(32), workday_num bigint NOT NULL, workday_denom bigint NOT NULL, rate_num bigint NOT NULL, rate_denom bigint NOT NULL, addr_name varchar(1024) CHARACTER SET utf8, addr_addr1 varchar(1024) CHARACTER SET utf8, addr_addr2 varchar(1024) CHARACTER SET utf8, addr_addr3 varchar(1024) CHARACTER SET utf8, addr_addr4 varchar(1024) CHARACTER SET utf8, addr_phone varchar(128) CHARACTER SET utf8, addr_fax varchar(128) CHARACTER SET utf8, addr_email varchar(256) CHARACTER SET utf8) INSERT INTO versions VALUES('employees',2) CREATE TABLE entries(guid varchar(32) PRIMARY KEY NOT NULL, date DATETIME NULL DEFAULT '1970-01-01 00:00:00' NOT NULL, date_entered DATETIME NULL DEFAULT '1970-01-01 00:00:00', description varchar(2048) CHARACTER SET utf8, action varchar(2048) CHARACTER SET utf8, notes varchar(2048) CHARACTER SET utf8, quantity_num bigint, quantity_denom bigint, i_acct varchar(32), i_price_num bigint, i_price_denom bigint, i_discount_num bigint, i_discount_denom bigint, invoice varchar(32), i_disc_type varchar(2048) CHARACTER SET utf8, i_disc_how varchar(2048) CHARACTER SET utf8, i_taxable integer, i_taxincluded integer, i_taxtable varchar(32), b_acct varchar(32), b_price_num bigint, b_price_denom bigint, bill varchar(32), b_taxable integer, b_taxincluded integer, b_taxtable varchar(32), b_paytype integer, billable integer, billto_type integer, billto_guid varchar(32), order_guid varchar(32)) INSERT INTO versions VALUES('entries',4) CREATE TABLE invoices(guid varchar(32) PRIMARY KEY NOT NULL, id varchar(2048) CHARACTER SET utf8 NOT NULL, date_opened DATETIME NULL DEFAULT '1970-01-01 00:00:00', date_posted DATETIME NULL DEFAULT '1970-01-01 00:00:00', notes varchar(2048) CHARACTER SET utf8 NOT NULL, active integer NOT NULL, currency varchar(32) NOT NULL, owner_type integer, owner_guid varchar(32), terms varchar(32), billing_id varchar(2048) CHARACTER SET utf8, post_txn varchar(32), post_lot varchar(32), post_acc varchar(32), billto_type integer, billto_guid varchar(32), charge_amt_num bigint, charge_amt_denom bigint) INSERT INTO versions VALUES('invoices',4) CREATE TABLE jobs(guid varchar(32) PRIMARY KEY NOT NULL, id varchar(2048) CHARACTER SET utf8 NOT NULL, name varchar(2048) CHARACTER SET utf8 NOT NULL, reference varchar(2048) CHARACTER SET utf8 NOT NULL, active integer NOT NULL, owner_type integer, owner_guid varchar(32)) INSERT INTO versions VALUES('jobs',1) CREATE TABLE orders(guid varchar(32) PRIMARY KEY NOT NULL, id varchar(2048) CHARACTER SET utf8 NOT NULL, notes varchar(2048) CHARACTER SET utf8 NOT NULL, reference varchar(2048) CHARACTER SET utf8 NOT NULL, active integer NOT NULL, date_opened DATETIME NULL DEFAULT '1970-01-01 00:00:00' NOT NULL, date_closed DATETIME NULL DEFAULT '1970-01-01 00:00:00' NOT NULL, owner_type integer NOT NULL, owner_guid varchar(32) NOT NULL) INSERT INTO versions VALUES('orders',1) CREATE TABLE taxtables(guid varchar(32) PRIMARY KEY NOT NULL, name varchar(50) CHARACTER SET utf8 NOT NULL, refcount bigint NOT NULL, invisible integer NOT NULL, parent varchar(32)) INSERT INTO versions VALUES('taxtables',2) CREATE TABLE taxtable_entries(id integer PRIMARY KEY AUTO_INCREMENT NOT NULL, taxtable varchar(32) NOT NULL, account varchar(32) NOT NULL, amount_num bigint NOT NULL, amount_denom bigint NOT NULL, type integer NOT NULL) INSERT INTO versions VALUES('taxtable_entries',3) CREATE TABLE vendors(guid varchar(32) PRIMARY KEY NOT NULL, name varchar(2048) CHARACTER SET utf8 NOT NULL, id varchar(2048) CHARACTER SET utf8 NOT NULL, notes varchar(2048) CHARACTER SET utf8 NOT NULL, currency varchar(32) NOT NULL, active integer NOT NULL, tax_override integer NOT NULL, addr_name varchar(1024) CHARACTER SET utf8, addr_addr1 varchar(1024) CHARACTER SET utf8, addr_addr2 varchar(1024) CHARACTER SET utf8, addr_addr3 varchar(1024) CHARACTER SET utf8, addr_addr4 varchar(1024) CHARACTER SET utf8, addr_phone varchar(128) CHARACTER SET utf8, addr_fax varchar(128) CHARACTER SET utf8, addr_email varchar(256) CHARACTER SET utf8, terms varchar(32), tax_inc varchar(2048) CHARACTER SET utf8, tax_table varchar(32)) INSERT INTO versions VALUES('vendors',1) BEGIN INSERT INTO books(guid,root_account_guid,root_template_guid) VALUES('d8cc59a2d29750d48e10d8e272fa8045','2f41c27ebff3f5b278c16d9cdde10354','14433b7bdf303237a146123e9600fa98') ROLLBACK SHOW TABLES FROM `gnucash` LIKE 'gnclock' BEGIN SELECT * FROM gnclock WHERE Hostname = 'Infinity' AND PID = '8376' DELETE FROM gnclock COMMIT
I think there is no DROP DB transaction?
Is this a dup of bug 789594, except MariaDB instead of SQLite3? If you want to replace a database, drop or rename the old one from the command line. GnuCash doesn't at present implement overwriting a SQL database.
I think no. I can write file normaly. And I can't create DB with another name via gnucash. Gnucash always drop and create new db in sql or it's update transactions?
I don't understand what you mean that you "can write file normally". It shouldn't care about database names. What error do you get when you try to create a DB with a different name? On the other hand if you're trying to create a database that already exists there *should* be a MySQL error and it seems that there isn't. GnuCash doesn't drop databases except when it has begun to create one and there's a problem with the installed libdbi. There's no handler for the case where the database already exists and you tell GnuCash to create a new one of the same name, which is the substance of bug 789594.
Just a note that this works ok on 2.6.19, at least with mysql. A couple of years ago on the version then current it used to fail, then that was fixed and it has worked since. I note that in the trace it does come up with a message saying it may clobber the database, before failing.
About file I can overwrite existing gnucash file or create new, all works fine. About SQL MariaDB DB I can't "save as" gnucash into existing gnucash db (previous times it was the overwrite question, at last time it isn't) and can't save db with another new name. There is the same error: "The server at URL ... experienced an error or encountered bad or corrupt data.". If existing db - no waiting, if new name - about 10 sec waiting and then error. But Transaction that I created for testing already in DB. Maybe I missed the description of some release note, but before the changes got to the database it was necessary to perform the saving. At version 3.0 and earlier overwriting the existing database was working normal. Is now there no need to save the gnucahs after work, if you work through the mysql?
OK, you mean that you can save to an XML file without trouble. When you're using a SQL backend--MySQL/MariaDB, Postgresql, or SQLite3--everything is saved into the database immediately. There's no need to explicitly save or save as. That's always been true of the SQL backends, in fact it's the original point of having them.
I have just pushed a fix for this issue. It will appear in gnucash 3.3. It's a quasi dupe of bug 789594 in that the same logic error was there for both database types. However the logic error happened in different code paths for both db types, so I'm treating them differently.