SQL Server to Postgres Migration#7547
SQL Server to Postgres Migration#7547labkey-martyp wants to merge 3 commits intorelease26.3-SNAPSHOTfrom
Conversation
…fb_tnprc_migration
labkey-adam
left a comment
There was a problem hiding this comment.
Please review suggestions from me and Claude. I also suggest running Claude /review_pr after changes. If its findings are off, consider adding comments that address.
| new MethodSqlTest("SELECT TIMESTAMPDIFF2(SQL_TSI_YEAR, CAST('15 Jan 2003' AS TIMESTAMP), CAST('15 Jan 2006' AS TIMESTAMP))", JdbcType.INTEGER, 3), | ||
| new MethodSqlTest("SELECT TIMESTAMPDIFF2(SQL_TSI_YEAR, CAST('14 Jan 2006' AS TIMESTAMP), CAST('15 Jan 2003' AS TIMESTAMP))", JdbcType.INTEGER, -2), | ||
| new MethodSqlTest("SELECT TIMESTAMPDIFF2(SQL_TSI_FRAC_SECOND, CAST('01 Jan 2004 5:00:00' AS TIMESTAMP), CAST('01 Jan 2004 5:00:01' AS TIMESTAMP))", JdbcType.BIGINT, 1000), | ||
| new MethodSqlTest("SELECT TIMESTAMPDIFF2(SQL_TSI_FRAC_SECOND, CAST('01 Jan 2004' AS TIMESTAMP), CAST('31 Jan 2004' AS TIMESTAMP))", JdbcType.BIGINT, 2592000000L), |
There was a problem hiding this comment.
Add test for age_in_days()?
| case "SQL_TSI_SECOND" -> | ||
| new SQLFragment("TRUNC(EXTRACT(EPOCH FROM (").append(end).append(") - (").append(start).append(")))::INT"); | ||
| case "SQL_TSI_FRAC_SECOND" -> | ||
| new SQLFragment("TRUNC(EXTRACT(EPOCH FROM (").append(end).append(") - (").append(start).append(")) * 1000)::BIGINT"); |
There was a problem hiding this comment.
Claude is complaining about this BIGINT vs. Method defining timestampdiff2 as returning JdbcType.INTEGER.
There was a problem hiding this comment.
In limited local testing, I didn't see any problem with very large values, though.
| } | ||
|
|
||
| private SQLFragment getWholeElapsedMonths(SQLFragment start, SQLFragment end) | ||
| { |
There was a problem hiding this comment.
This method assumes that start and end don't include any parameters. Current callers don't, but best to add a comment and an invariant check for that, i.e., throw if either has parameters.
Rationale
Two functions were added as part of the SQL Server to Postgres migration.
Related Pull Requests
Changes