Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0046240Openbravo ERPA. Platformpublic2021-04-09 14:442022-02-01 07:24
mtaal 
Triage Platform Base 
normalmajorhave not tried
newopen 
5
 
 
Core
No
0046240: dbsourcemanager export database model does not support postgresql typecasting
In postgresql you can do things like this:
 WHERE dt.date_actual > (now() - '2 years'::interval)

When using this in a materialized view and exporting it through the reporting server export action (which uses dbsourcemanager) it removes the '::interval' causing incorrect sql to be stored in our source code repos.

We have to manually repair the sql before pushing.

I saw the same with other type casting. This can also give trouble when calling postgresql functions as without type inference the function is not recognized.



A simple example mv which would go wrong. Not sure if the dbsourcemanager out of the box exports materialized views.

-- DROP MATERIALIZED VIEW public.m_test_export;

CREATE MATERIALIZED VIEW public.m_test_export
TABLESPACE pg_default
AS
 SELECT o.ad_org_id
   FROM c_order o
  WHERE o.created > (now() - '2 years'::interval)
WITH NO DATA;

ALTER TABLE public.m_test_export
    OWNER TO tad;
No tags attached.
Issue History
2021-04-09 14:44mtaalNew Issue
2021-04-09 14:44mtaalAssigned To => platform
2021-04-09 14:44mtaalModules => Core
2021-04-09 14:44mtaalTriggers an Emergency Pack => No
2022-02-01 07:24alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.