Skip to content

SQL Server to Postgres Migration#7547

Open
labkey-martyp wants to merge 2 commits intorelease26.3-SNAPSHOTfrom
26.3_fb_tnprc_migration
Open

SQL Server to Postgres Migration#7547
labkey-martyp wants to merge 2 commits intorelease26.3-SNAPSHOTfrom
26.3_fb_tnprc_migration

Conversation

@labkey-martyp
Copy link
Copy Markdown
Contributor

@labkey-martyp labkey-martyp commented Apr 3, 2026

Rationale

Two functions were added as part of the SQL Server to Postgres migration.

  1. timestampdiff2: This is a work around for the parameter swapping issue in the PG JDBC timestampdiff function. This implementation does not use the pass through JDBC timestampdiff function. This may be a temporary function depending on PG JDBC group fixing the underlying issue with parameter swapping.
  2. age_in_days: This is to preserve the timestampdiff(SQL_TSI_DAY_0, param1, param2) SQL Server behavior. By default timestampdiff with frequency of days/months/years on SQL Server will count calendar boundaries. On Postgres, timestampdiff counts actual time between parameters, so a day is 24 hours. This will be a permanent addition to LabKey SQL.

Related Pull Requests

Changes

  • timestampdiff2 function added with tests
  • age_in_days method added and SQL_TSI_DAY added as option in age() method

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.

1 participant