Skip to content

Sharding tests do not work (using default settings) #535

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

Closed
mdashti opened this issue Jul 30, 2023 · 2 comments
Closed

Sharding tests do not work (using default settings) #535

mdashti opened this issue Jul 30, 2023 · 2 comments

Comments

@mdashti
Copy link
Contributor

mdashti commented Jul 30, 2023

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. Switch to the recent commit on main @ 9d1c46a
  2. Follow the instructions in the https://github.com/postgresml/pgcat/blob/main/tests/sharding/README.md
  • start a postgres server
  • run psql -f query_routing_setup.sql
  • start up PgCat by running cargo run --release in the root of the repo
  • run psql -h 127.0.0.1 -p 6432 -f query_routing_test_insert.sql
    - this command does not work, and I run this one instead: PGPASSWORD=sharding_user psql sharded_db -h 127.0.0.1 -p 6432 -U sharding_user -f query_routing_test_insert.sql

Expected behavior
It's expected for the test to run successfully. However, it fails with:


SET SHARDING KEY
INSERT 0 1
psql:query_routing_test_insert.sql:6: ERROR:  syntax error at or near "KEY"
LINE 1: SET SHARDING KEY TO '2';
                     ^

Desktop

  • OS: macOS
  • Version: 1.1.1 (main @ 9d1c46a)
@mdashti
Copy link
Contributor Author

mdashti commented Jul 31, 2023

This diff fixes the issue:

diff --git a/pgcat.toml b/pgcat.toml
index 3e8801b..d8ed108 100644
--- a/pgcat.toml
+++ b/pgcat.toml
@@ -270,7 +270,7 @@ username = "sharding_user"
 # if `server_password` is not set.
 password = "sharding_user"
 
-pool_mode = "session"
+pool_mode = "transaction"
 
 # PostgreSQL username used to connect to the server.
 # server_username = "another_user"

@mdashti mdashti changed the title Sharding Tests Do Not Work Sharding tests do not work (using default settings) Jul 31, 2023
@levkk
Copy link
Contributor

levkk commented Jul 31, 2023

Could you submit a PR with the fix if you have a moment?

levkk added a commit that referenced this issue Aug 2, 2023
@levkk levkk closed this as completed Aug 2, 2023
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

No branches or pull requests

2 participants