Forum OpenACS Q&A: PostreSQL version incompatibility and Query Dispatcher

Version 7.2 of PostgreSQL introduced a few changes that have broken OpenACS here and there, especially Calendar. Many of these can be fixed by re-writing queries listed in .xql files. The question is, however, can Query Dispatcher be enhanced somewhat (unless it can already do this) to support the following:

<?xml version="1.0"?>
<queryset>
 <rdbms>
  <type>postgresql</type>
  <version>7.1</version>
 </rdbms>

 <fullquery name="timestamp_query">
  <querytext>
    select timestamp(:some_date) from dual
  </querytext>
 </fullquery>
</queryset>

<queryset>
 <rdbms>
  <type>postgresql</type>
  <version>7.2</version>
 </rdbms>

 <fullquery name="timestamp_query">
  <querytext>
    select timestamp :some_date from dual
  </querytext>
 </fullquery>
</queryset>
The new form of timestamp also works on 7.1 (well, 7.1.3 anyway) so you can just rewrite them in the new form. If older 7.1 versions don't support it please let me know.

I checked in a couple fixes for this on calendar but I think calendar is pretty hosed right now (I understand Ben Adida is working on it). I have it working for a single calendar and non recurring events but a bunch of other bits are missing (choosing calendars, creating recurring events, etc).

All this is beside the point, since there are some places where you need to support multiple versions of the same DBMS eg like in schema browser if it had used the query dispatcher (db internals tend to change around a lot across versions).

The real answer is that you follow the guidelines in https://openacs.org/4/query-dispatcher and name the files blah-postgresql-7.2.xql and version distinguished data model files similiarly. Of course since there are no files at all in the tree like this now you will have to tell us if it works :)

You shouldn't need to name those .xql files with 7.2 in the
filename. Right now you can only have one queryset per .xql file,
but you can specify the RDBMS in the fullquery if you want to
override the RDBMS specified in the queryset. So you should be
able to do what you want there.