Patch suggestion for gnucash 1.8.8 (ports/finance/gnucash) postgres backend.

Richard Schilling rschi at rsmba.biz
Mon Jul 26 19:58:34 PDT 2004


I have created a patch that you can put into the "files" subdirectory of 
the gnucash port.  It's attached.

Gnucash, when creating a database for the Postgres backend uses the 
value returned from nl_langinfo(CODESET) to build up SQL queries.  In 
particular the value returned from nl_langinfo(CODESET) is used to set 
the encoding in the Postgres database in the following SQL command:

      CREATE DATABASE gnucash_database_name WITH ENCODING 'US-ASCII';

nl_langinfo(CODESET) returns the string "US-ASCII" on my BSD system. 
When US-ASCII is used to build up SQL queries for the Postgres backend, 
Postgres generates an error because "US-ASCII" is not allowed to be used 
as an option in Postgres SQL.

Would you be willing to Patch the gnucash code to substitute US-ASCII 
with SQL_ASCII as it is used?  The effected file is:

work/gnucash-1.8.8/src/backend/postgres/PostgresBackend.c, line 2100.


Thanks.

Richard Schilling
(206) 774-5951



-------------- next part --------------
*** src/backend/postgres/PostgresBackend.orig	Mon Jul 26 17:17:45 2004
--- src/backend/postgres/PostgresBackend.c	Mon Jul 26 17:33:16 2004
***************
*** 2104,2109 ****
--- 2104,2114 ----
           if (!strcmp (encoding, "ANSI_X3.4-1968"))
             encoding = "SQL_ASCII";
  
+          if (!strcmp(encoding, "US-ASCII"))
+            encoding = "SQL_ASCII";
+ 
+          printf("\nDatabase encoding is: %s.\n", encoding);
+ 
           /* create the database */
           p = be->buff; *p =0;
           p = stpcpy (p, "CREATE DATABASE ");


More information about the freebsd-gnome mailing list