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 105235 - The postgres backend fails saving existing DB and creating a new db
The postgres backend fails saving existing DB and creating a new db
Status: VERIFIED NOTABUG
Product: GnuCash
Classification: Other
Component: Backend - SQL
1.8.x
Other other
: Normal major
: ---
Assigned To: Chris Shoemaker
linas
Depends on:
Blocks:
 
 
Reported: 2003-02-04 20:50 UTC by David Wilson
Modified: 2018-06-29 20:27 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David Wilson 2003-02-04 20:50:41 UTC
The postgres backend opens and existing db but fails to update it to the 
the vertion. It fails to create a new db on a freshly inited db area and 
new db. 
The is gnucash popup a bout bad and corrupt data. 
 
Debug optput - 
 
 NOTICE:  CREATE TABLE / UNIQUE will create implicit index 
'gncversion_name_key' for table 'gncversion' 
NOTICE:  CREATE TABLE / UNIQUE will create implicit index 
'gncversion_name_key' for table 'gncversion' 
ERROR:  Relation 'gncversion' already exists 
Error: pgend_create_db: finish query failed: 
        ERROR:  Relation 'gncversion' already exists 
 
Error: pgend_create_db: send query failed: 
        another command is already in progress 
 
Error: pgend_session_begin: send query failed: 
        another command is already in progress 
 
 
** CRITICAL **: file gnc-component-manager.c: line 271 
(gnc_cm_event_handler): assertion `id_type' failed. 
 
 
-------------------- 
Note; there is no other command in progress. I have restarted the database 
(single user PC)and immeditatly tried the save. 
 
 
Note changeing the mode setting to single-update does not cahnge anything.
Comment 1 Matthew Vanecek 2003-02-06 02:48:07 UTC
I've recreated the problem with trying to create a new set of tables
in an existing empty database. This is caused by 1) trying to open an
existing database, then 2) finding no gnuchash tables, and creating a
gncVersion table, then 3) finding no other gnucash tables and offering
to create them, which create includes gncVersion (which already
exists).  Trying to create a table that already exists fails.  Any
failure in a table creation is by necessity cause  to abort the process.

If you try to open a non-existent database, then gnucash can
successfully create it and the tables.  As a matter of fact, the
available documentation specifies this:

"Note: GnuCash will automatically create the database if it does
not already exist. Do *not* try to create the database by hand,
or to specify a database that wasn't created by GnuCash."

The README has other useful information regarding using the Postgresql
backend. Please read it.  For the moment, allow Gnucash to create the
database.  The Postgresql server must be running, and template1 must
have been created (initdb does this).  Other than that, you don't need
(and shouldn't) create the database.

This is admittedly a bug, and will not happen in the rewritten version
of the PG backend.  I may try to correct this in the existing version,
if I have time.  It really shouldn't try to create that one table twice.
Comment 2 David Wilson 2003-02-10 04:51:23 UTC
Ok I have got it to create the new database, all the tables are 
created. I open my file version of my accounts and save it to the new 
db, all seemingly ok and no error messages but when I make any change 
I get the following error - 
------------------ 
Warning: pgend_session_begin: mode=single-update is final beta -- 
we've fixed all known bugs but that doesn't mean 
there aren't any! We think it's safe to use. 
 
Segmentation fault 
[dnw@capulet gnucash]$ DEBUG:  pq_recvbuf: unexpected EOF on client 
connection 
--------------------- 
 
If I try to open the db there is no account information. 
 
Comment 3 Fabien COELHO 2003-02-23 14:49:57 UTC
From Matthew Venecek comment I devised the following workaround,
so as to save gnucash data to empty but created postgres database.

Indeed, I can see no reason why my basic account should be
previleged for database creation from the database point of view.

1/ open your newly created fresh and empty database with psql
   psql cash

2/ start gnucash
   select save-as then postgres://localhost/cash

3/ when the confirm creattion dialog appeats, do nothing!

4/ go first to your psql and type "DROP TABLE gncversion;"
   to get rid of the just create table.

5/ come back to the dialog and select "Yes" to create the tables.

35 tables are created and data seem to be saved... I was nearly happy
with the result...

then at the first modification attempt on an account, I had a guile
crash. Thus I derive that the SQL backhand does not work with gnucash
1.8.1 and postgres 7.2.1.

Now if I give my basic account previleged database creation rights,
it seems to work correctly... So let's go with it with a lot
of "save"...
Comment 4 Chris Shoemaker 2006-05-24 20:16:00 UTC
Ok, sounds like the bottom line is: GnuCash has to create the database itself.

It seems that's by design.  Closing as NOTABUG.
Comment 5 John Ralls 2018-06-29 20:27:15 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=105235. Please update any external references or bookmarks.