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

Remove max year from timestamptz #689

Merged

Conversation

greg-rychlewski
Copy link
Member

I think we can just do this? Postgres will return an error if the timestamp is out of range with the message

message: "timestamp out of range:..."

@wojtekmach
Copy link
Member

Sounds good to me. What do you think about adding a test? Curious if the error differs between pg versions we support.

@greg-rychlewski
Copy link
Member Author

Good idea. I added a test for the negative bound because the upper bound will crash on most elixir versions.

@greg-rychlewski greg-rychlewski merged commit 0dfa7ef into elixir-ecto:master Jul 6, 2024
8 of 9 checks passed
@wojtekmach
Copy link
Member

@greg-rychlewski I was rather thinking about this:

  test "decode timestamptz out of bounds", context do
    %Postgrex.Error{postgres: %{message: message}} =
      query("SELECT $1::timestamptz", [~U[-4713-01-01 00:00:00Z]])

    assert message =~ "timestamp out of range"
  end

so it goes through encoding which was the change here. WDYT? If this sounds good to you, Im happy to make the change on main.

@greg-rychlewski
Copy link
Member Author

sounds good, please go for it:) thank you

wojtekmach added a commit that referenced this pull request Jul 8, 2024
@greg-rychlewski greg-rychlewski deleted the timestamptz_max_year branch July 8, 2024 22:59
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