Postgres chagnes

Linas Vepstas linas at linas.org
Mon Aug 11 21:27:11 CDT 2003



Hi,

I noticed that the postgres backend changed recently, and thought 
to take a quick look. I spotted one obvious bug immediately:

Index: PostgresBackend.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/backend/postgres/PostgresBackend.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -p -r1.48 -r1.49
--- PostgresBackend.c   27 Jul 2003 19:20:00 -0000      1.48
+++ PostgresBackend.c   10 Aug 2003 20:24:24 -0000      1.49
@@ -2204,10 +2204,10 @@ pgend_session_begin (QofBackend *backend
                qof_backend_set_error (&be->be, ERR_SQL_DB_BUSY);
                return;
              }
-             pgendUpgradeDB (be);
              p = "COMMIT;\n";
              SEND_QUERY (be,p, );
              FINISH_QUERY(be->connection);
+             pgendUpgradeDB (be);
            }
            else
            {

Whoever did this cleary didn't look at what   pgendUpgradeDB (be);
does: its a routine that automatically and transparently makes 
the postgres backend upwards compatible with older versions ... 

Also, *EVERY* change to upgrade.c is fundamentally incorrect !! 
I REALLY WANT TO TYPE THE FOLLOWING IN CAPTIAL LETTERS:

You cannot change gncEntry to gncSplit in put_iguid_in_tables()
(for example), because databases on which this routine would run 
do not have tables which have column names called gncSplit!

Making such changes misses the entire point of this file !
This file is supposed to convert *old* databases, that have 
(for example) old/obsolete column names, to new databases,
having new/renamed columns!

In this particular case, it needs a new routine that will 
CREATE TABLE gncSplit, and then INSERT INTO gncSplit SELECT * FROM gncEntry;
so as to copy from the old table name to the new table name!
So I'm reverting these changes right now ... 

=========================================================
I'm auditing the changes right now.  I am hoping that the above is the
only thing wrong that I find ... 

--linas
-- 
pub  1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas at linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984  3F54 64A9 9A82 0104 5933


More information about the gnucash-devel mailing list