Detects and resolves Snowflake-specific SQL that fails in PostgreSQL.
PostgreSQL rejects Snowflake-only keywords, data types, and functions. Common offenders are QUALIFY
, TO_VARIANT()
, and the $
identifier escape. When these appear, the parser raises a syntax error before execution.
Run EXPLAIN
or click the Galaxy linter. The first unexpected token in the stack trace pinpoints the Snowflake clause.Remove or rewrite from that token onward to continue parsing.
SAMPLE
, QUALIFY
, and MINUS
lack native support. Substitute with CTEs, subqueries, or EXCEPT
in PostgreSQL.
Snowflake allows "My Column$"
. PostgreSQL supports double quotes but not trailing $
in identifiers. Rename the column or alias it without the symbol.
PostgreSQL treats $$
as a string delimiter, not an identifier wrapper, leading to misaligned tokens.Switch to single quotes for strings or double quotes for identifiers.
Map each function: TO_DATE()
→ DATE()
, TO_VARIANT()
→ JSONB_BUILD_OBJECT()
, IFF()
→ CASE WHEN
. Validate output with SELECT
samples.
Adopt ANSI-compliant SQL. Enable Galaxy’s dialect hints set to PostgreSQL. Keep a migration cheat-sheet listing Snowflake-only features and their PostgreSQL counterparts.
.
No. PostgreSQL does not offer a compatibility mode. You must rewrite syntax to ANSI or PostgreSQL-specific equivalents.
Galaxy’s AI copilot suggests PostgreSQL-friendly rewrites. For batch conversion, use open-source transpilers like SQLGlot with the target dialect set to postgres.