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

Interval of 0s is invalid #2034

Closed
obs-gh-patrickscott opened this issue May 29, 2024 · 4 comments · Fixed by #2035
Closed

Interval of 0s is invalid #2034

obs-gh-patrickscott opened this issue May 29, 2024 · 4 comments · Fixed by #2035
Labels

Comments

@obs-gh-patrickscott
Copy link

Describe the bug
An interval of 0s is serialized to a blank string due to 01d649b

It used to serialize to 00:00:00.000000. Now postgres will error if a 0s interval is serialized. This is because Value() uses the TextFormatCode which uses this new format.

Expected behavior
Inserting a 0s interval should be fine.

Actual behavior
[Postgres](pq: invalid input syntax for type interval: "")

Version

  • Go: 1.21.7
  • PostgreSQL: PostgreSQL 13.6 (Debian 13.6-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
  • pgx: 5.6.0

Additional context
Add any other context about the problem here.

@obs-gh-patrickscott
Copy link
Author

In addition to the above issue, an interval of something simple like 6 minutes will serialize to ' 00:06:00' (note the leading space).

@jackc
Copy link
Owner

jackc commented May 29, 2024

@exekias ⬆️

@exekias
Copy link
Contributor

exekias commented May 30, 2024

Most likely I introduced this issue 🙏, let me check, happy to open a PR to fix it!

@exekias
Copy link
Contributor

exekias commented May 30, 2024

#2035

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants