After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 794765 - when saving as into a PostgreSQL database, things fail because of renaming the numtest table twice
when saving as into a PostgreSQL database, things fail because of renaming th...
Status: RESOLVED OBSOLETE
Product: GnuCash
Classification: Other
Component: Backend - SQL
2.6.19
Other Linux
: Normal critical
: ---
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2018-03-28 14:01 UTC by Joost Helberg
Modified: 2018-06-30 00:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Joost Helberg 2018-03-28 14:01:40 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.
Comment 1 Geert Janssens 2018-03-29 17:13:28 UTC
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 ?
Comment 2 Joost Helberg 2018-03-29 19:41:13 UTC
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.
Comment 3 John Ralls 2018-03-29 19:52:03 UTC
2.6.20 isn't released yet. You can clone our repo at https://github.com/Gnucash/gnucash.
Comment 4 John Ralls 2018-03-29 20:07:26 UTC
Hmm, bug 790506 showed similar symptoms. What locale is your pg server set to?
Comment 5 Joost Helberg 2018-04-02 08:05:19 UTC
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.
Comment 6 Geert Janssens 2018-04-28 14:23:05 UTC
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).
Comment 7 John Ralls 2018-06-30 00:06:10 UTC
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.