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

[Go] How to use prepared statements with timestamps #39

Open
si-fernandes opened this issue Jan 2, 2024 · 0 comments
Open

[Go] How to use prepared statements with timestamps #39

si-fernandes opened this issue Jan 2, 2024 · 0 comments

Comments

@si-fernandes
Copy link

si-fernandes commented Jan 2, 2024

Describe the usage question you have. Please include as many useful details as possible.

Hello,

I'm trying to implement a prepared statement that has a timestamp parameter.
I have prepared statements working with strings, but with timestamps I'm getting a schema mismatch error.
I'm using v14.

The query for the prepared statement is SELECT * FROM x where name = $1 AND $2 <= timestamp.
I have no problems with the first parameter.
I'm building the second parameter using the type arrow.FixedWidthTypes.Timestamp_ns.
I've tried passing a time.Time as the value and it failed. Then I tried an arrow.Timestamp but that also failed with the same error.

The error I'm getting is:

Parameter schema does not equal Placeholder schema. (...) 
Received: (...) Field {name: \"$2\", data_type: Timestamp(Nanosecond, Some(\"UTC\")), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }
Expected: (...)Field { name: \"$2\", data_type: Timestamp(Nanosecond, None), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }

I would like to know what's the best way to overcome this timezone difference in the schemas.

Thank you

EDIT:
I have also tried casting the timestamp to timestamptz in the query, but that leads to the mismatch

Received: Timestamp(Nanosecond, Some(\"UTC\"))
Expected: Timestamp(Nanosecond, Some(\"+00:00\"))

Component(s)

Go

@assignUser assignUser transferred this issue from apache/arrow Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant