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

Update tokio-postgres example to demonstrate Hyperdrive #569

Merged
merged 2 commits into from
May 7, 2024

Conversation

kflansburg
Copy link
Member

No description provided.

@kflansburg
Copy link
Member Author

@xortive, might need your help to get this working. I believe that using StartTLS is the right way to go based on node-postgres code. I'm pretty confident that this example will not use a prepared statement.

I get the following errors:

db error: FATAL: Internal error.
Error: Network connection lost.

cc @avsaase

@kflansburg
Copy link
Member Author

I've tried disabling TLS entirely, as well as constructing the Config object without the full connection string (just username, password, and database). Same error both times. Could be a bug in the workers-rs Socket Stream implementation, but difficult to narrow things down.

@KianNH
Copy link
Contributor

KianNH commented May 7, 2024

I'm pretty confident that this example will not use a prepared statement.

simple_query won't use prepared statements but query will, I believe. The issue is that tokio-postgres doesn't support unnamed statements and Hyperdrive doesn't support prepared statements - so query won't work.

I had this issue in my blog about using tokio-postgres in workers-rs.

tokio-postgres does not currently support unnamed statements, which is required since connection poolers do not support prepared statements.

We will be using a fork by devsnek as the pull request has not been merged yet.

I didn't use Tls though, that's likely a separate issue, but I think you will run into issues using query regardless.

@kflansburg
Copy link
Member Author

simple_query won't use prepared statements but query will, I believe. The issue is that tokio-postgres doesn't support unnamed statements and Hyperdrive doesn't support prepared statements - so query won't work.

This fixed it, thanks!

@kflansburg kflansburg force-pushed the kflansburg/hyperdrive-example branch from ee5df07 to cd2b262 Compare May 7, 2024 13:10
@kflansburg kflansburg force-pushed the kflansburg/hyperdrive-example branch from cd2b262 to 5512b77 Compare May 7, 2024 13:20
@kflansburg kflansburg merged commit 5c4048f into main May 7, 2024
3 checks passed
@kflansburg kflansburg deleted the kflansburg/hyperdrive-example branch May 7, 2024 15:08
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.

2 participants