engine: quote join's aliases (#37495)
This commit is contained in:
parent
a7737d32c1
commit
6716a7594f
|
@ -28,6 +28,10 @@ psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
|
|||
psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
|
||||
|
||||
|
||||
def quote(s):
|
||||
return '"%s"' % s.replace('"', '\\"')
|
||||
|
||||
|
||||
def cast_point(value, cur):
|
||||
if value is None:
|
||||
return None
|
||||
|
@ -333,7 +337,7 @@ class EngineCube(object):
|
|||
else:
|
||||
sql = '%s' % table_name
|
||||
if alias:
|
||||
sql += ' AS %s' % alias
|
||||
sql += ' AS %s' % quote(alias)
|
||||
add_paren = False
|
||||
for kind in ['left', 'inner', 'right', 'full']:
|
||||
joins = join_tree.get(alias or table_name, {}).get(kind)
|
||||
|
@ -358,7 +362,7 @@ class EngineCube(object):
|
|||
conditions.append('%s.%s = %s.%s' % (
|
||||
alias or table_name,
|
||||
join.master.split('.')[-1],
|
||||
join.name, join.detail))
|
||||
quote(join.name), join.detail))
|
||||
sub_join = ' CROSS JOIN '.join(sub_joins)
|
||||
if len(sub_joins) > 1:
|
||||
sub_join = '(%s)' % sub_join
|
||||
|
|
Loading…
Reference in New Issue