Daily/Monthly/Annually charts not working with PostgreSQL

Hi,

I’ve just realized that all the Daily/Monthly/Annually charts (e.g.
DueDaily) are not working with PostgreSQL from a very primitive reason.

I was surprised not to find this in the mailing list or Wiki.

It seems that RT code (RT::Report::tickets::_ FieldToFunction) assumes that
the date strings (such as Due, Resolved, etc.) are strings that can be
manipulated via “SUBSTR” to get their year/year+month/year+month+day.

This does not work in PostgreSQL where these fields are defined as timestamp
type.

It seems “date_part”" or “extract” functions should be used instead.

I didn’t except such DB vendor-specific code in RT.

Has anyone ran into this problem and/or has a solution before I try to go
into it myself?

Thanks,

Eynat

Hi,

I’ve just realized that all the Daily/Monthly/Annually charts (e.g.
DueDaily) are not working with PostgreSQL from a very primitive reason.

I was surprised not to find this in the mailing list or Wiki.

It seems that RT code (RT::Report::tickets::_ FieldToFunction) assumes that
the date strings (such as Due, Resolved, etc.) are strings that can be
manipulated via “SUBSTR” to get their year/year+month/year+month+day.

This does not work in PostgreSQL where these fields are defined as timestamp
type.

Interestingly, I believe that at one point Postgres DID automatically
marshal date types into strings. O***cle does. :wink:

I’d absolutely love a patch to make our logic work better on Pg,
especially if it came with the tests we’re clearly missing to make sure
nobody ever breaks it again.

-jesse