Forum OpenACS Development: Collation dependency in apm_package_version__sortable_version_name

The strings returned by apm_package_version__sortable_version_name depend on your database having LOCALE=C. On a non-C locale you get things like:

intranet=# select
apm_package_version__sortable_version_name('4.0.1') >
apm_package_version__sortable_version_name('4.0');
 ?column?
----------
 f
(1 row)

The strings being compared in this case are:

intranet=# select apm_package_version__sortable_version_name('4.0.1');
 apm_package_version__sortable_v
---------------------------------
 0004.0000.0001.  3F.
(1 row)

intranet=# select apm_package_version__sortable_version_name('4.0');
 apm_package_version__sortable_v
---------------------------------
 0004.0000.  3F.
(1 row)

Anyone got any bright ideas for fixing this? Can we use the "bit varying" trick here?