Forum OpenACS Q&A: Re: 4.6.3 ecommerce belches request-error on ugly_date

Collapse
Posted by Torben Brosten on
Parroting others, I'm getting errors in various parts of ecommerce.

'clock scan' is unable to process fractional time values (nanoseconds) from pg7.2.

These URLs address similar problems:

https://openacs.org/irc/log/2003-10-19
https://openacs.org/bugtracker/openacs/bug?bug_number=595
https://openacs.org/bugtracker/openacs/bug?bug_number=985
https://openacs.org/forums/message-view?message_id=33632

and for reference:

http://www.postgresql.org/docs/7.2/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
http://www.postgresql.org/docs/7.2/static/datatype-datetime.html

Given that I will gladly re-install with fresh DB if necessary..

What is the best (recipe style, or monkey-see monkey-do) way to approach this?

Would changing *all* cases in ecommerce of the sql time functions to integer seconds, ie current_timestamp(0) current_time(0) work (with re-install)?

Or, should I stick to changing just the references that affect 'clock scan', by changing for example current_timestamp to current_timestamp::timestamp(0) ?

ps. I would be glad to do 'worker-bee' work (including testing pg version) with this package.

Collapse
Posted by Bart Teeuwisse on
Torben,

Ideally I would replace the date/time definitions in the ecommerce
data model to:

  timestamp (0) without time zone

Developers can then request a timestamp which can be processed by
'clock scan' without massaging the return value from SQL.

This data model change -for all practical purposes- is not back-wards
compatible with prior ecommerce versions. It would be too involved to
update an existing ecommerce installation.

Changing the data-model would involve less changes than changing all
the functions and queries that retrieve data/time from the database
to:

  select <date/time field>::timestamp(0);

However the advantage of this approach is that it doesn't involve any
data model changes and is back-wards compatible.

<rant>
Let me re-iterate that the ecommerce package is a huge and complex
package with a long history and an equally long list of developers who
worked on it. The package does a lot but the design and large portions
of the code are rather abominable. Fixing the date/time issue is
required to continue the use of the ecommerce package but for the long
run this package should really be broken up into several smaller
packages.
</rant>

So Torben, given that upgrading existing ecommerce installations
rarely ever happen -most are too customized to be upgraded- I would
recommend to change the data model and remove all Tcl code that
stripped the microsecond portion of a timestamp.

/Bart