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 790506 - GnuCash 2.6.18 does not work with PostgreSQL lc_messages != 'english'
GnuCash 2.6.18 does not work with PostgreSQL lc_messages != 'english'
Status: RESOLVED OBSOLETE
Product: GnuCash
Classification: Other
Component: Backend - SQL
2.6.18
Other Windows
: Normal normal
: future
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2017-11-17 15:40 UTC by Jorge
Modified: 2018-06-30 00:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnclock table (25.35 KB, image/png)
2017-11-17 15:40 UTC, Jorge
Details
gnucash error (22.56 KB, image/png)
2017-11-17 15:40 UTC, Jorge
Details
gnucash trace (17.86 KB, text/plain)
2017-11-17 16:12 UTC, Jorge
Details
users on pgadmin (27.77 KB, image/png)
2017-11-17 18:14 UTC, Jorge
Details
postgresql log (32.17 KB, text/plain)
2017-11-17 18:36 UTC, Jorge
Details
gnucash log (1.23 KB, text/plain)
2017-11-18 00:48 UTC, Jorge
Details
postgresql log (367 bytes, text/plain)
2017-11-18 00:49 UTC, Jorge
Details
gnucash trace after change locale (1.22 KB, text/plain)
2017-11-18 04:12 UTC, Jorge
Details
postgresql config locale (44.28 KB, text/plain)
2017-11-18 18:15 UTC, Jorge
Details
postgresql log (47.49 KB, text/plain)
2017-11-24 18:16 UTC, Jorge
Details

Description Jorge 2017-11-17 15:40:04 UTC
Created attachment 363932 [details]
gnclock table

Hi,

Using gnucash 2.6.18 and postgresql 9.5 (the remote access is configured), on a clear installation i get this message: 

"The server at URL postgres://postgres@10.8.0.1/gnucash experienced an error or encountered bad or corrupt data."

I tried with another user with all privileges and get the same error,

I tried installing a postgresql server local and get the same error,

If exists a database with name gnucash i get a message to overwrite the database, when i click in yes, get the same error, but it create an empty table named "gnclock"
Comment 1 Jorge 2017-11-17 15:40:52 UTC
Created attachment 363933 [details]
gnucash error
Comment 2 John Ralls 2017-11-17 16:06:19 UTC
Please attach the trace file. See https://wiki.gnucash.org/wiki/Tracefile for where to find it. Please also attach the database logs covering the times of the failed sessions.

Please note that we can't provide any support for database configuration or administration. Database server users are expected to be experts in the operation of their servers or to employ such an expert.
Comment 3 Jorge 2017-11-17 16:12:04 UTC
Created attachment 363934 [details]
gnucash trace

Added the gnucash trace file
Comment 4 John Ralls 2017-11-17 18:04:21 UTC
OK, the database is refusing to accept the transactions. The logs should show why.

Did you remember to grant create database on the user?
Comment 5 Jorge 2017-11-17 18:14:16 UTC
yes, i tried with 2 users, the super user postgres and a gnucash user with create database privilege
Comment 6 Jorge 2017-11-17 18:14:48 UTC
Created attachment 363944 [details]
users on pgadmin
Comment 7 Jorge 2017-11-17 18:36:55 UTC
Created attachment 363945 [details]
postgresql log

I can see that it try to rename the table 'numtest' 2 times, where the errors begin


017-11-17 12:29:50 CST LOG:  sentencia: SELECT relname FROM pg_class WHERE relname !~ '^pg_' AND relkind = 'r' AND relowner = (SELECT datdba FROM pg_database WHERE datname = 'gnucash') ORDER BY relname
2017-11-17 12:29:50 CST LOG:  sentencia: ALTER TABLE numtest RENAME TO numtest_back
2017-11-17 12:29:50 CST LOG:  sentencia: ALTER TABLE numtest RENAME TO numtest_back
2017-11-17 12:29:50 CST ERROR:  no existe la relación «numtest»
Comment 8 John Ralls 2017-11-17 23:38:33 UTC
OK, I managed to replicate your failure by trying to overwrite an existing database with a fresh save-as. Try dropping the database or using a new name.
Comment 9 Jorge 2017-11-18 00:48:00 UTC
Created attachment 363957 [details]
gnucash log

without overwrite database i got the same error, but the log is different, gnucash does not create the database.
Comment 10 Jorge 2017-11-18 00:49:46 UTC
Created attachment 363958 [details]
postgresql log

postgresql log, gnucash does not send a "create database" statement
Comment 11 John Ralls 2017-11-18 03:23:40 UTC
That looks like you tried "File>Open" rather than "File>Save As...".
Comment 12 Jorge 2017-11-18 03:34:26 UTC
Yes, i know, but i did a "File>Save As..."
Comment 13 John Ralls 2017-11-18 03:44:51 UTC
The line
CRIT <gnc.core-utils> gnc_uri_get_components: assertion 'uri != NULL && strlen (uri) > 0' failed

might be a clue. That implies that there was a problem retrieving the values from the database dialog box (the one that collects host, database name, user name, and password).

I wonder if there might be a localization problem. Can you switch the locale to English_UnitedStates (you can edit c:\Program Files (x86)\gnucash\etc\gnucash\environment if you don't want to change the computer's locale).
Comment 14 Jorge 2017-11-18 04:12:11 UTC
Created attachment 363963 [details]
gnucash trace after change locale

i changed the locale to en_US and i got the same error, that means that is not retrieving the values to make the URI?
Comment 15 John Ralls 2017-11-18 04:38:33 UTC
I think it's still a localization issue, but not one that can be solved by changing GnuCash's locale.

I think that the problem is that Postgresql (or maybe libdbdpgsql) doesn't set an error code for "database not found", so GnuCash has to parse the error message. I was just looking at that in the debugger this afternoon while I was following the file opening process. It does that in English so the Spanish error message isn't detected and GnuCash doesn't set the "database exists" flag to False and so it doesn't realize that it needs to create the database.

If it's practical for you to change the locale of the postgresql server to English that might be a workaround and a useful test. I'll see if I can find a way to get the flag set in a locale-neutral way for 2.8.
Comment 16 Jorge 2017-11-18 18:15:51 UTC
Created attachment 363981 [details]
postgresql config locale

Yes, that is the problem, i changed the postgresql.conf, switch the locales 

from

lc_messages = 'Spanish_Nicaragua.1252'
lc_monetary = 'Spanish_Nicaragua.1252'
lc_numeric = 'Spanish_Nicaragua.1252'
lc_time = 'Spanish_Nicaragua.1252'

to

lc_messages = 'english'
lc_monetary = 'english'
lc_numeric = 'english'
lc_time = 'english'

It works!
Comment 17 Frank H. Ellenberger 2017-11-23 23:33:46 UTC
Jorge, can you test it with:

lc_messages = 'english'
lc_monetary = 'Spanish_Nicaragua.1252'
lc_numeric = 'Spanish_Nicaragua.1252'
lc_time = 'Spanish_Nicaragua.1252'
Comment 18 Jorge 2017-11-24 18:16:19 UTC
Created attachment 364350 [details]
postgresql log

Hi Frank,

I tested with that configuration and works fine,
Comment 19 Frank H. Ellenberger 2017-11-24 18:25:10 UTC
Next question:

Is this specific to Windows or are other OSes also affected?
Comment 20 John Ralls 2017-11-24 18:44:41 UTC
Frank,

It's generic. See https://github.com/Gnucash/gnucash/blob/maint/src/backend/dbi/gnc-backend-dbi.c#L1333.

The obvious fix is to use error codes instead, but as I said in comment 15 the error code isn't set for this particular error. Since the error level--"FATAL"--isn't localized we could assume that that combined with err_num == 0 means that there's no DB and it needs to be created. That's a bit brittle but it might be our best choice.
Comment 21 Geert Janssens 2018-03-29 20:00:35 UTC
The numtest table was the source of bug 794765 as well. Perhaps my (potential) fix for that one will help here as well ? I wasn't aware of the lc_messages influence though so possibly my idea was way off.
Comment 22 John Ralls 2018-06-30 00:00:44 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=790506. Please continue processing the bug there and please update any external references or bookmarks.