From: Mark Hymers Date: Sat, 26 Mar 2011 11:15:09 +0000 (+0000) Subject: Avoid using an SQL keyword as a column name X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=3cff7f4ee092a25c35040e11bae8f4c5df2d53fa;p=dak.git Avoid using an SQL keyword as a column name Signed-off-by: Mark Hymers --- diff --git a/dak/dakdb/update56.py b/dak/dakdb/update56.py index e33cec96..f04ebc87 100755 --- a/dak/dakdb/update56.py +++ b/dak/dakdb/update56.py @@ -37,7 +37,7 @@ def do_update(self): try: c = self.db.cursor() - c.execute("ALTER TABLE metadata_keys ADD COLUMN order INTEGER NOT NULL DEFAULT 0") + c.execute("ALTER TABLE metadata_keys ADD COLUMN ordering INTEGER NOT NULL DEFAULT 0") initial_order = { 'Package': -2600, @@ -80,7 +80,7 @@ def do_update(self): } for key, order in initial_order.items(): - c.execute("""UPDATE metadata_keys SET "order" = '%s' WHERE key ILIKE '%s'""" % (order, key)) + c.execute("""UPDATE metadata_keys SET ordering = '%s' WHERE key ILIKE '%s'""" % (order, key)) c.execute("UPDATE config SET value = '56' WHERE name = 'db_revision'") self.db.commit() diff --git a/dak/generate_packages_sources2.py b/dak/generate_packages_sources2.py index b6bc1c21..8d8a8aef 100755 --- a/dak/generate_packages_sources2.py +++ b/dak/generate_packages_sources2.py @@ -63,7 +63,7 @@ SELECT WHEN key = 'Checksums-Sha1' THEN E'Checksums-Sha1\:\n ' || f.sha1sum || ' ' || f.size || ' ' || SUBSTRING(f.filename FROM E'/([^/]*)\\Z') WHEN key = 'Checksums-Sha256' THEN E'Checksums-Sha256\:\n ' || f.sha256sum || ' ' || f.size || ' ' || SUBSTRING(f.filename FROM E'/([^/]*)\\Z') ELSE key || '\: ' - END || value, E'\n' ORDER BY mk.order, mk.key) + END || value, E'\n' ORDER BY mk.ordering, mk.key) FROM source_metadata sm JOIN metadata_keys mk ON mk.key_id = sm.key_id @@ -162,7 +162,7 @@ WITH SELECT (SELECT - STRING_AGG(key || '\: ' || value, E'\n' ORDER BY mk.order, mk.key) + STRING_AGG(key || '\: ' || value, E'\n' ORDER BY mk.ordering, mk.key) FROM binaries_metadata bm JOIN metadata_keys mk ON mk.key_id = bm.key_id