-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #25713: ReportsExecution doesn't have timezone on all fields #5959
base: branches/rudder/8.1
Are you sure you want to change the base?
Fixes #25713: ReportsExecution doesn't have timezone on all fields #5959
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CheckTableReportsExecutionTz
appears to be missing from the checks at boot, otherwise changes look fine.
There is also a question : why is 'UTC' the timezone we have assumed to be written in the column, and not the PG session timezone ?
fr"table_name = " ++ Fragment.const("'" + testTable + "'"), | ||
fr"column_name in (" ++ Fragment.const("'" + insertionDateColumn + "'") | ||
) ++ fr", " ++ Fragment.const("'" + complianceComputationDateColumn + "'") ++ fr")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it's a parameterized queries, it can just be interpolated within the fragment, no ?
fr"table_name = ${testTable}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, yes, but not in the ALTER TABLE part, so I wanted to make it very clear that we can't use the same things in both place by using the same construct with a different escaping rule.
where table_name = """ ++ toQuotedFr(table) ++ fr" and column_name = " ++ toQuotedFr( | ||
column | ||
) ++ fr""" and data_type = 'timestamp with time zone' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The table and column does not need to be constant fragment but can simply be interpolated, since they are standard parameterized arguments for the query, and not part of the SQL DML syntax,
for instance :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added and fixed the quoting convention - we always use ${}
|
||
val alter: Fragment = fr"ALTER TABLE " ++ toFr(table) ++ fr" ALTER COLUMN " ++ toFr( | ||
column | ||
) ++ fr" TYPE TIMESTAMP WITH TIME ZONE USING " ++ toFr(column) ++ fr" AT TIME ZONE 'UTC';" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure for the 'UTC' timezone, in our Doobie Meta we write dates using no specific timezone and I thought the PG session current timezone is used (SHOW TIMEZONE;
), so maybe 'UTC' is a special test value here ?
I could not test the behavior because I have no reports locally but I believe that if the timezone is something else than UTC we could end up assigning wrong values to the columns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't any information about what was used to write these timezone, this is lost for ever. The server config can have changed. And since it's not really use, it doesn't not matter. UTC is a as correct value, as other and in case of problem it will be much more easy to guess what happened if we don't have to check for what was the timezone when the migration was done.
PR updated with a new commit |
Wow, yes I didn't merge the port in RudderConfig in the PR 😓 |
PR updated with a new commit |
b0241b0
to
4da4bd3
Compare
https://issues.rudder.io/issues/25713