Hi !!
These types of issues are exactly why you use a database abstraction layer (so you don't have to fork your code). I agree with John (although I am unfamiliar with PEAR::DB) that there must be a way to deal with this in the db abstraction. I have used the adodb library for php pretty extensively and I know it contains this functionality (no... I am not suggestioning that anyone change db abstraction layers, one should work just as well as the other)
I also agree with this, there is a way to do it without forking the code.
Some of the queries use backticks to quote column names - pgsql uses double quotes.
in the future is better to use column names without spaces and special characters and also avoid using reserved words as column names so no quoting is need. Nevertheless MySQL could also use double quotes if started with --sql-mode="ANSI_QUOTES" Anyway at this development stage maybe it will be better to identify all problematic column names and rename them so no quoting is need. Having to implement functions for each database backend looks better now but this adds overhead to each query and new database backeds will not be plug&play as they will need all those functions to be implemented.