Commit 70e9f19
committed
fix(stack): probe eql_v3.version() in its own statement
CI failed on a fresh database with
`PostgresError: schema "eql_v3" does not exist` (3F000) from hasCurrentEqlV3.
Postgres resolves function references while parsing a statement, before any
branch of it executes. So in
SELECT CASE
WHEN to_regprocedure('eql_v3.version()') IS NULL THEN NULL
ELSE eql_v3.version()
END
the ELSE branch is resolved even when the guard would have short-circuited:
the statement raises 3F000 when the eql_v3 schema is absent, and 42883 when
the schema exists but the function does not. The guard only ever succeeded
when it was not needed.
to_regprocedure() itself is fine — it takes the name as a string and yields
NULL rather than raising. Split the probe into its own statement and only
then call eql_v3.version(), so the call is parsed after existence is known.
Every local run had already installed EQL v3, so the empty-database path was
never exercised — the case the previous commit message claimed was safe.
Verified against a fresh ghcr.io/cipherstash/postgres-eql:17-2.3.1 (no eql_v3):
v3 suites 237 passed; full packages/stack suite 1,055 passed / 0 failed. Also
covers the schema-present-but-no-version() case: reinstalls rather than raising.1 parent cfd46ee commit 70e9f19
1 file changed
Lines changed: 22 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
| |||
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
46 | | - | |
| 53 | + | |
| 54 | + | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | | - | |
| 63 | + | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| |||
0 commit comments