From 9ff298585a056bbcf2116523eb58f39e3de8a1c8 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 9 Aug 2007 19:44:42 +0000 Subject: [PATCH] - when reflecting tables from alternate schemas, the "default" placed upon the primary key, i.e. usually a sequence name, has the "schema" name unconditionally quoted, so that schema names which need quoting are fine. its slightly unnecessary for schema names which don't need quoting but not harmful. --- CHANGES | 6 ++++++ lib/sqlalchemy/databases/postgres.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index e0a59eddac..621ea0db09 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,12 @@ - mssql - added support for TIME columns (simulated using DATETIME) [ticket:679] - index names are now quoted when dropping from reflected tables [ticket:684] +- postgres + - when reflecting tables from alternate schemas, the "default" placed upon + the primary key, i.e. usually a sequence name, has the "schema" name + unconditionally quoted, so that schema names which need quoting are fine. + its slightly unnecessary for schema names which don't need quoting + but not harmful. 0.3.10 - general diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index d3726fc1ff..d0b97175df 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -464,7 +464,7 @@ class PGDialect(ansisql.ANSIDialect): # the default is related to a Sequence sch = table.schema if '.' not in match.group(2) and sch is not None: - default = match.group(1) + sch + '.' + match.group(2) + match.group(3) + default = match.group(1) + ('"%s"' % sch) + '.' + match.group(2) + match.group(3) colargs.append(schema.PassiveDefault(sql.text(default))) table.append_column(schema.Column(name, coltype, nullable=nullable, *colargs)) -- 2.47.2