Postgres backend findings

Matthew Vanecek mevanecek at yahoo.com
Mon Mar 3 22:15:17 CST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 3 Mar 2003, Dwayne Miller wrote:

> I know the PG backend is being redone, so forgive me if the following is 
> OBE....
> 
> - During ./configure, the line that tries to compile a file looking for 
> the location of the postgres headers returns some warnings.  I had to 
> add a "-w" flag to the compile step so that the warnings would be 
> suppressed and the configure step would succeed.  The warnings were 
> something about "/usr/include" path being redefined.  I'm not sure 
> what's going on here.

Dunno about that.  Might want to look through the archives for whatever 
warning you got.  The archives are downloadable and searchable via grep 
(ruffin it, I tell ya!).
 
> - After successful compile, trying to save to a postgres database 
> failed.  Looks like the logic tries to save to an existing database 
> first.  In my case, the PG database existed, but none of the gnucash 
> tables existed.  Well, it tries to determine the version of the database 
> by querying gncversion.  That table does not exist, so the 
> pgendVersionTable creates one.  Gnucash then reports that the version is 
> out of date and asks if I want to upgrade, but that fails because none 
> of the remaining table have been created yet.

Saving to an existing database that wasn't created by Gnucash will not 
work, as you have discovered.  This is actually explained in the README. 
If you save to a non-existent database, your data will save OK.

> 
> It looks like the high level logic wants to try to save to an existing 
> database by calling pgend_session_begin with create_new_db as false.  If 
> that fails, then it will recall pgend_session_begin with create_new_db 
> as true.  But it looks like the first pass through pgend_session_begin 
> ends up with a single table being created, and the second pass fails 
> because that is all that exists.
> 
> I can try to rework the logic in pgend_session_begin() unless that's 
> already been updated (I'm in v1.8.1 code).
>

You're welcome to submit a patch.  I'm using the existing implementation 
more as a reference for interacting with the Engine.  However, others have 
tried to first manually create the database, then to save to it.  It may 
be "user-friendly" to allow that (and will be allowed in new 
implementation).

Do be careful with the pgend_session_begin() code.  It's pretty, umm, 
intricate.  I'm not real sure what the reasoning was for creating the 
version table if it didn't exist--personally, I'd rather assume that the 
absence of the version table indicates absence of *all* Gnucash tables.

Patches should be directed to the gnucash-devel and gnucash-patches lists.


- -- 
Matthew Vanecek
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
********************************************************************************
For 93 million miles, there is nothing between the sun and my shadow except me.
I'm always getting in the way of something...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+ZChgi/CNzDSN0RIRAkmTAJ0Vwz2aP29jMixRgrlhzEz6xWPZmwCeKgnM
2UtbzuQIRI10LpM9d44WKkQ=
=lFXc
-----END PGP SIGNATURE-----



More information about the gnucash-user mailing list