Snowflake wrapper does not quote identifiers, causing failures with mixed-case column names #40991
Replies: 1 comment 1 reply
|
From what I can tell the problem comes down to one core issue
Snowflake only preserves case when identifiers are wrapped in double quotes
Even if the SELECT list is quoted queries will still break if WHERE or ORDER BY references appear unquoted
just create a simple view like "PK_Well" and "API Number" and confirm the generated SQL stays valid
some Snowflake schemas or providers use mixed case table or view names too so quoting these avoids edge case failures |
Uh oh!
There was an error while loading. Please reload this page.
Bug Description
The Snowflake wrapper does not quote column identifiers when generating SQL queries, which causes query failures when Snowflake tables/views have mixed-case column names.
Current Behavior
When I query a foreign table mapped to a Snowflake view with mixed-case columns like
"PK_Well"or"API Number", I get this error:ERROR: HV000: guest fdw error: HTTP status error (422 Unprocessable Entity)
Checking Snowflake's query history shows:
SQL compilation error: error line 1 at position 7 invalid identifier 'PK_WELL'
The wrapper is generating unquoted SQL:
Reproduction
Root Cause
In wasm-wrappers/fdw/snowflake_fdw/src/lib.rs, the deparse() method doesn't quote identifiers:
Proposed Fix
Also quote table names, WHERE clause columns, and ORDER BY columns.
Impact
This affects Snowflake shared databases and data marketplace providers that use mixed-case column names (very common). Currently unusable for these cases.
Workaround
Create uppercase views in Snowflake, but this is impractical for 100+ column tables from third-party data providers.
Environment
I'm willing to submit a PR to fix this if the maintainers agree with the approach. The fix would involve:
deparse()methodAll reactions