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

fix: harmonydb: Use timestampz instead of timestamp across the schema #12030

Merged
merged 3 commits into from
May 22, 2024

Conversation

magik6k
Copy link
Contributor

@magik6k magik6k commented May 22, 2024

Related Issues

Proposed Changes

It appears that pgx doesn't pay attention to time.Time timezone field, and fails to convert the time value to whatever Timezone the backing postgres (yb) is configured to run; At the same time our schema uses the timestamp [without time zone] type all over the place, and that type accounts for time is units of seconds starting at postgres epoch as defined in the databases local timezone.

To make postgres store time in terms of seconds since postgres epoch in UTC we need to switch to timestampz (iiuc same type as TIMESTAMP WITH TIME ZONE), or alternatively do SET TIME ZONE 'UTC' on all connections - tho that option is much less robust imo (falls apart when external application connects to the database which will then think that it is in a different TZ).

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • If the PR affects users (e.g., new feature, bug fix, system requirements change), update the CHANGELOG.md and add details to the UNRELEASED section.
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

Copy link

github-actions bot commented May 22, 2024

All checks have completed

❌ Failed Test / Test (itest-deals) (pull_request)
❌ Failed Test / Test (itest-path_type_filters) (pull_request)

@magik6k magik6k force-pushed the fix/harmony-timestamps branch from 47b6f72 to 31b6360 Compare May 22, 2024 14:41
@magik6k magik6k force-pushed the fix/harmony-timestamps branch from c974e78 to 06342b1 Compare May 22, 2024 15:33
@magik6k magik6k merged commit 7dae7dd into master May 22, 2024
94 of 96 checks passed
@magik6k magik6k deleted the fix/harmony-timestamps branch May 22, 2024 19:41
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.

3 participants