Summary
get_routines runs the PG 11+ prokind query unconditionally. The built-in driver checks server_version_num and falls back to a pre-PG-11 query that uses proisagg/proiswindow. On PostgreSQL 10.x (and older), the plugin's query fails with SQLSTATE 42703 column "prokind" does not exist.
Builtin behavior (upstream main)
src-tauri/src/drivers/postgres/mod.rs::get_routines:
let server_version_num: i32 = query_one(
&pool,
"SELECT current_setting('server_version_num')::int4 AS v", &[],
).await?.try_get("v").unwrap_or(0);
let query = if server_version_num >= 110000 {
// PG 11+: SELECT proname, prokind … AND prokind IN ('f', 'p')
} else {
// Pre-11: SELECT proname, 'f'::"char" AS prokind … AND NOT proisagg AND NOT proiswindow
};
Plugin behavior (this repo)
src/handlers/metadata.rs:665 — hardcoded single query with a comment:
// PG 11+ uses prokind; older versions use proisagg/proiswindow flags.
// CI runs PG 16, so we use the modern query.
let query = r#"
SELECT proname, prokind
FROM pg_proc
WHERE pronamespace = … AND prokind IN ('f', 'p')
ORDER BY proname
"#;
No version check, no fallback.
Impact
- Severity: Low-Medium. PostgreSQL 10 is EOL (Nov 2022), but the built-in driver explicitly supports it and this is a trivial port. A user on a legacy PG server sees
get_routines return a -32603 error (and the routine browser fails to load) instead of a routine list.
- Not caught by the parity suite (CI runs PG 16 only).
Fix
Port the version branch: query current_setting('server_version_num')::int4, pick the query by >= 110000, run it. Add a test (the version-branch selection is unit-testable by testing both query strings; the live behavior on PG 10 would need a PG 10 container, likely #[ignore]).
Related
- Builtin reference:
TabularisDB/tabularis drivers/postgres/mod.rs::get_routines (the server_version_num branch).
- Related upstream issue:
TabularisDB/tabularis#375 ("Schema introspection fails on PostgreSQL < 11 (column 'prokind' does not exist)") — same root cause on the builtin side, already fixed there.
Summary
get_routinesruns the PG 11+prokindquery unconditionally. The built-in driver checksserver_version_numand falls back to a pre-PG-11 query that usesproisagg/proiswindow. On PostgreSQL 10.x (and older), the plugin's query fails with SQLSTATE 42703column "prokind" does not exist.Builtin behavior (upstream
main)src-tauri/src/drivers/postgres/mod.rs::get_routines:Plugin behavior (this repo)
src/handlers/metadata.rs:665— hardcoded single query with a comment:No version check, no fallback.
Impact
get_routinesreturn a-32603error (and the routine browser fails to load) instead of a routine list.Fix
Port the version branch: query
current_setting('server_version_num')::int4, pick the query by>= 110000, run it. Add a test (the version-branch selection is unit-testable by testing both query strings; the live behavior on PG 10 would need a PG 10 container, likely#[ignore]).Related
TabularisDB/tabularisdrivers/postgres/mod.rs::get_routines(theserver_version_numbranch).TabularisDB/tabularis#375("Schema introspection fails on PostgreSQL < 11 (column 'prokind' does not exist)") — same root cause on the builtin side, already fixed there.