From e38041b6a85aab7c0d67ee9393f16231c4f52e30 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 30 Sep 2019 13:40:24 +0200 Subject: [PATCH 2/2] replace more explicit quoting by quote() (#36503) --- wcs_olap/feeder.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wcs_olap/feeder.py b/wcs_olap/feeder.py index 1cb1ae9..fa70dac 100644 --- a/wcs_olap/feeder.py +++ b/wcs_olap/feeder.py @@ -350,12 +350,12 @@ CREATE TABLE public.dates AS (SELECT def create_table(self, name, columns, inherits=None, comment=None): sql = 'CREATE TABLE %s' % quote(name) - sql += '(' + ', '.join('"%s" %s' % (n, t) for n, t in columns) + ')' + sql += '(' + ', '.join('%s %s' % (quote(n), t) for n, t in columns) + ')' if inherits: - sql += ' INHERITS ("%s")' % inherits + sql += ' INHERITS (%s)' % quote(inherits) self.ex(sql) if comment: - self.ex('COMMENT ON TABLE "%s" IS %%s' % name, vars=(comment,)) + self.ex('COMMENT ON TABLE %s IS %%s' % quote(name), vars=(comment,)) def prev_table_exists(self, name): query = """SELECT EXISTS (SELECT 1 FROM information_schema.tables @@ -636,7 +636,7 @@ class WcsFormdefFeeder(object): else: # open item field, from data sources... self.create_labeled_table_serial(table_name, comment=comment) - field_def = 'integer REFERENCES "%s" (id)' % table_name + field_def = 'integer REFERENCES %s (id)' % quote(table_name) elif field.type == 'bool': field_def = 'boolean' elif field.type == 'string': @@ -843,7 +843,7 @@ class WcsFormdefFeeder(object): self.logger.warning('no data') return self.ex('INSERT INTO {formdata_table} ({columns}) VALUES {values} RETURNING id', - ctx=dict(columns=', '.join(['"%s"' % column for column in self.columns[1:]]), values=', '.join(values))) + ctx=dict(columns=', '.join(['%s' % quote(column) for column in self.columns[1:]]), values=', '.join(values))) # insert generic evolutions generic_evolutions = [] -- 2.23.0