Ignore SET key = 'value' queries on PostgreSQL interface (#416)
Some checks failed
build / build (push) Has been cancelled
build / build_ui (push) Has been cancelled
build / database_test (push) Has been cancelled
build / object_store_memory_test (push) Has been cancelled
build / object_store_direct_test (push) Has been cancelled
build / openssl_build (push) Has been cancelled
build / mac_cross_build (push) Has been cancelled
build / Docker Image Build (push) Has been cancelled
roapi release / Validate git tag (push) Has been cancelled
roapi release / macos (push) Has been cancelled
roapi release / windows (map[features:database-sqlite python-architecture:x64 target:x86_64-pc-windows-msvc]) (push) Has been cancelled
roapi release / linux (map[features:rustls,database-sqlite image_tag:aarch64-musl manylinux:2014 name_suffix: target:aarch64-unknown-linux-musl upload:true]) (push) Has been cancelled
roapi release / linux (map[features:rustls,database-sqlite image_tag:x86_64-musl manylinux:2010 name_suffix: target:x86_64-unknown-linux-musl upload:true]) (push) Has been cancelled
roapi release / PyPI Release (push) Has been cancelled
roapi release / Docker Image Release (push) Has been cancelled

## Problem
CrateDB's built-in PostgreSQL JDBC FDW connector emits this SQL
statement, which currently fails on ROAPI:
```sql
SET application_name = 'PostgreSQL JDBC Driver'
```

## Solution
Ignore all `SET key = 'value'` queries, or, to be more precise, all
queries starting with `SET`. Is it too harsh?

## References
- GH-415
-
https://github.com/crate/cratedb-examples/pull/1286#pullrequestreview-3549651369
This commit is contained in:
Andreas Motl 2025-12-08 03:53:06 +01:00 committed by GitHub
parent 63d51cfcdd
commit 4d649d78b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -116,7 +116,8 @@ impl<H: RoapiContext> RoapiQueryHandler<H> {
info!("executing query: {query}");
// Handle some special PostgreSQL queries
if query.trim().to_lowercase().starts_with("show") {
let query_normalized = query.trim().to_lowercase();
if query_normalized.starts_with("show") || query_normalized.starts_with("set") {
let empty_schema = Arc::new(vec![]);
let empty_stream = stream::iter(vec![]);
return Ok(QueryResponse::new(empty_schema, empty_stream));