You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm completely new to River and immediately ran into the following issue when playing with the examples against Pg 16.4:
msg="Elector: Error attempting to elect" err="ERROR: cannot cast type bigint to interval (SQLSTATE=42846)"
The offending LeaderAttemptElect SQL is attempting to cast an integer time.Duration parameter into a Pg interval which is not allowed. Weird that nobody else appears to have hit the same issue, I wonder where I've gone wrong!?
Anyway, I'm currently working around this by patching all 4 instances of now() + $2 in the river source with now() + make_interval(secs => $2), as recommended in this issue: sqlc-dev/sqlc#429 (comment)
The text was updated successfully, but these errors were encountered:
@NathanBaulch I’m not sure how this could have slipped past our testing 🤔 can you confirm that you’re using the dbsql driver, as well as the underlying db driver you’re using (pgx or other)?
OK, that was a bit of a rabbit hole but it turns out the bun sql driver my project uses doesn't prepare statements before execution (for alleged perf reasons). That step is required in order to infer that the @ttl parameter should be interpreted as an interval (oid 1186), otherwise the underlying int64 is used.
Is there any interest in supporting non-prepare-ing drivers? I'd be happy to send a PR that replaces ::interval with make_interval(...).
Ah, it seems like you're using Bun's own pgdriver which I don't think we've tried, so it seems likely to be an issue specific to that. We have a fair bit of test coverage for the drivers including the LeaderAttemptElect query, but that uses pgx under the hood via its stdlib database/sql package.
Have you tried Bun with pgx, or is that not an option for some reason?
bgentry
changed the title
cannot cast type bigint to interval
Query errors with riverdatabasesql, Bun, and pgdriver
Oct 25, 2024
I'm completely new to River and immediately ran into the following issue when playing with the examples against Pg 16.4:
The offending
LeaderAttemptElect
SQL is attempting to cast an integertime.Duration
parameter into a Pginterval
which is not allowed. Weird that nobody else appears to have hit the same issue, I wonder where I've gone wrong!?Anyway, I'm currently working around this by patching all 4 instances of
now() + $2
in the river source withnow() + make_interval(secs => $2)
, as recommended in this issue: sqlc-dev/sqlc#429 (comment)The text was updated successfully, but these errors were encountered: