Skip to content
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

Open
wants to merge 1 commit into
base: branches/rudder/8.1
Choose a base branch
from

Conversation

fanf
Copy link
Member

@fanf fanf commented Oct 23, 2024

@fanf fanf requested a review from clarktsiory October 23, 2024 10:05
Copy link
Contributor

@clarktsiory clarktsiory left a 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 ?

Comment on lines +109 to +111
fr"table_name = " ++ Fragment.const("'" + testTable + "'"),
fr"column_name in (" ++ Fragment.const("'" + insertionDateColumn + "'")
) ++ fr", " ++ Fragment.const("'" + complianceComputationDateColumn + "'") ++ fr")"
Copy link
Contributor

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}"

Copy link
Member Author

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.

Comment on lines +108 to +110
where table_name = """ ++ toQuotedFr(table) ++ fr" and column_name = " ++ toQuotedFr(
column
) ++ fr""" and data_type = 'timestamp with time zone'
Copy link
Contributor

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 :

(the License header is missing from that file 🙈)

Copy link
Member Author

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';"
Copy link
Contributor

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

Copy link
Member Author

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.

@fanf
Copy link
Member Author

fanf commented Nov 6, 2024

PR updated with a new commit

@fanf
Copy link
Member Author

fanf commented Nov 6, 2024

Wow, yes I didn't merge the port in RudderConfig in the PR 😓

@fanf
Copy link
Member Author

fanf commented Nov 6, 2024

PR updated with a new commit

@fanf fanf force-pushed the bug_25713/reportsexecution_doesn_t_have_timezone_on_all_fields branch from b0241b0 to 4da4bd3 Compare November 6, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants