GNOME Bugzilla – Bug 794765
when saving as into a PostgreSQL database, things fail because of renaming the numtest table twice
Last modified: 2018-06-30 00:06:10 UTC
My postgresql log reads: 2018-03-28 15:06:33 CEST [19609-49] joost@gc LOG: statement: ALTER TABLE numtest RENAME TO numtest_back 2018-03-28 15:06:33 CEST [19609-50] joost@gc LOG: duration: 0.415 ms 2018-03-28 15:06:33 CEST [19609-51] joost@gc LOG: statement: ALTER TABLE numtest RENAME TO numtest_back 2018-03-28 15:06:33 CEST [19609-52] joost@gc ERROR: relation "numtest" does not exist this stops me from exporting my gnucash file into the database. A quick fix in gnc-backend-dbi.c:1804 resolves the symptoms: static dbi_result conn_table_manage_backup (GncDbiSqlConnection *conn, gchar *table_name, TableOpType op ) { gchar *new_name = g_strdup_printf( "%s_%s", table_name, "back" ); dbi_result result = NULL; if( !strcmp(table_name, "numtest") ) { return result; } switch ( op ) { case backup: This doesn't solve the issue though, somehow the numtest table gets added into the tables to be renamed twice. Maybe the code for processing this list should weed out duplicates.
Thanks for your report. numtest is a temporary table, which should get deleted automatically. The postgresql backend documentation suggests it may be around for as long as the current connection remains open so that may explain why it's still there in your case. It's still puzzling because the code explicitly drops the table when finished with it. One error condition was missed (unable to create a row in the temporary table) so I have now also added a drop table statement in that situation. The fix will go in gnucash 2.6.20 and the 3.0 beta's. You may have to drop the table once from your existing sql db in order to proceed. Are you in a position to build gnucash from git and test ?
yes, given a URL to clone, I will be able to build it. Thanks for looking into this. I will try and find 2.6.20.
2.6.20 isn't released yet. You can clone our repo at https://github.com/Gnucash/gnucash.
Hmm, bug 790506 showed similar symptoms. What locale is your pg server set to?
pg server has en_US.UTF-8 and gnu cash client has nl_NL.UTF-8. It sure looks like a dulicate of 790506, but I'm not sure why locale settings could influence renameing a table twice which is not a candidate for renaming anyway. I will clone and try the fix as soon as it's available.
You can clone the repository John pointed at in comment 3 and check out tag 2.6.21 for your test build. That's the final 2.6 release which should have this fixed. Can you report your findings ? Alternatively you can check out the maint branch which we are preparing for a gnucash 3.1 stable release. The 3.x series is the new stable series (but I don't recommend version 3.0 at this point as there were lots of date related issues in there).
GnuCash bug tracking has moved to a new Bugzilla host. The new URL for this bug is https://bugs.gnucash.org/show_bug.cgi?id=794765. Please continue processing the bug there and please update any external references or bookmarks.