add quote_ident

This commit is contained in:
lsv 2025-11-28 14:14:08 +05:00
parent b1f67cbee8
commit 5defc3b12a
2 changed files with 2 additions and 2 deletions

View file

@ -2017,7 +2017,7 @@ void ctlSQLBox::OnAutoComplete(wxCommandEvent &rev)
sch = " and relnamespace =" + qtConnString(sch) + "::regnamespace"; sch = " and relnamespace =" + qtConnString(sch) + "::regnamespace";
} }
if (tabn[0] == '"') tabn.Replace("\"", ""); else tabn = tabn.Lower(); if (tabn[0] == '"') tabn.Replace("\"", ""); else tabn = tabn.Lower();
wxString sql2 = wxT("select string_agg(a.attname,E'\t') from pg_attribute a where a.attrelid = (select oid from pg_class p where relname=") + qtConnString(tabn) + sch wxString sql2 = wxT("select string_agg(quote_ident(a.attname),E'\t') from pg_attribute a where a.attrelid = (select oid from pg_class p where relname=") + qtConnString(tabn) + sch
+ wxT(") and a.attisdropped IS FALSE and a.attnum>=0 ") + flt + wxT(") and a.attisdropped IS FALSE and a.attnum>=0 ") + flt
+ wxT(""); + wxT("");
//pgSet *res = m_database->ExecuteSet(sql); //pgSet *res = m_database->ExecuteSet(sql);

View file

@ -83,7 +83,7 @@ void TableColsMap::BuildMapTableColumnsToSQLexp(Table *reltab, const wxString &a
int ncol = tmp[c].relcol; int ncol = tmp[c].relcol;
if (ncol < 1) continue; if (ncol < 1) continue;
tab_col_struct fnd = { rel,ncol }; tab_col_struct fnd = { rel,ncol };
wxString sqlname = tmp[c].name; wxString sqlname = qtIdent(tmp[c].name);
if (!alias.IsEmpty()) sqlname = alias + "." + sqlname; if (!alias.IsEmpty()) sqlname = alias + "." + sqlname;
map.insert({fnd,sqlname}); map.insert({fnd,sqlname});
} }