web: quote wizard source-query aliases with the source dialect
wizard_create built the generated source query's column aliases with the DEST driver's quote_identifier, but that query runs on the SOURCE. A pg->SQL Server module emitted "AS [col]" (SQL Server brackets) into a Postgres query, which failed with: syntax error at or near "[". The load maps columns by position, so the alias is cosmetic — quote it with the source dialect. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ea90b3f56a
commit
40c00bca7b
@ -724,9 +724,13 @@ async def wizard_create(request: Request):
|
|||||||
raise HTTPException(400, "no columns selected")
|
raise HTTPException(400, "no columns selected")
|
||||||
|
|
||||||
qualified_source = src_drv.qualified_table_name(table, **qvals)
|
qualified_source = src_drv.qualified_table_name(table, **qvals)
|
||||||
|
# Alias quoting must use the SOURCE dialect — this query runs on the
|
||||||
|
# source. (The load maps columns by position, so the alias is cosmetic;
|
||||||
|
# using dest quoting here leaked e.g. SQL Server [brackets] into a
|
||||||
|
# Postgres source query.)
|
||||||
select_list = ",\n ".join(
|
select_list = ",\n ".join(
|
||||||
f"{src_drv.default_expression(c['source_type'], c['source_name'])} AS "
|
f"{src_drv.default_expression(c['source_type'], c['source_name'])} AS "
|
||||||
f"{dest_drv.quote_identifier(c['dest_name'])}"
|
f"{src_drv.quote_identifier(c['dest_name'])}"
|
||||||
for c in chosen
|
for c in chosen
|
||||||
)
|
)
|
||||||
source_query_override = (form.get("source_query") or "").strip()
|
source_query_override = (form.get("source_query") or "").strip()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user