| 1 | package postgres_test |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/fiston-user/murmur/internal/platform/testdb" |
| 8 | ) |
| 9 | |
| 10 | // Every connection of a pool that Connect opened asks Postgres for one plan per statement. |
| 11 | func TestConnectAsksForOnePlan(t *testing.T) { |
| 12 | db := testdb.New(t) // testdb opens its pool with Connect |
| 13 | var mode string |
| 14 | if err := db.QueryRow(context.Background(), `show plan_cache_mode`).Scan(&mode); err != nil { |
| 15 | t.Fatal(err) |
| 16 | } |
| 17 | if mode != "force_generic_plan" { |
| 18 | t.Errorf("plan_cache_mode is %q, want force_generic_plan", mode) |
| 19 | } |
| 20 | } |