Forum OpenACS Development: Response to duplicate queries in .tcl, .xql, -oracle.xql, -postgresql.xql

Just from experience (not having looked at the query parser code), the precedence seems to be:

-postgres.xql/-oracle.xql

.xql

.tcl

The queries in the .xql file are common to all databases, but can be overridden in a db-specific xql file.  For instance, the .xql file might have a query with a SQL92 outer join.  This would work fine with postgres but not with Oracle 8x, so it will appear in the oracle xql file, but not the postgres xql file.  As for queries in the tcl files, yes, they could be eliminated.  They're only used when no corresponding query exists in a .xql file.  I personally like having them inline, as it's easy to see what the query is supposed to do.  It also speeds up development greatly to keep everything in the tcl file, then split it out later with automated scripts.