gnc allows postgres db called postgres

Wm wm+gnc at
Sat Apr 18 11:32:14 EDT 2015

In recent versions of postgres the database _named_ postgres is special, 
e.g. pgAdmin won't allow you to drop it because it is the default 
maintenance db.

gnc 2.6.6 (and presumably earlier versions) will allow a user to
file / save as / postgres
and call the Database postgres but shouldn't.

I discovered this by accident (working quickly, filled in the wrong 
field) and wondered at first why both gnc and postgres had allowed it.

I'm guessing gnc allows it because it doesn't (and arguably shouldn't) 
know of internal pg changes and pg allows it because someone has the 
permissions and has provided the right password and should know what 
they are doing.

I suggest simply not allowing anyone to call a postgres gnc db postgres.

There are some unknowns:

how to deal with the situation when a gnc user upgrades their postgres 
so the gnc db named postgres becomes special when it wasn't before.

recovering from someone making a user error as I did (easy enough if you 
know what you are doing but not if you're playing with grown up dbs for 
the first time).

I'm not sure of the way out and presume there are only a handful of 
people using the postgres backend who may all know what they are doing 
so it may not matter.


More information about the gnucash-devel mailing list