summaryrefslogtreecommitdiff
path: root/test/dialect/test_postgresql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-10-29 17:38:56 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-10-29 17:38:56 -0400
commite6a5ea8fa7d10078c8d3f1bf6cabc4399cac3e70 (patch)
tree316f3c5287a1389d214437dadb9c2dca0560410f /test/dialect/test_postgresql.py
parent5d6376fbd5ca4103a26118a6fffd1e95be0d5161 (diff)
downloadsqlalchemy-e6a5ea8fa7d10078c8d3f1bf6cabc4399cac3e70.tar.gz
- [bug] Postgresql dialect memoizes that an ENUM of a
particular name was processed during a create/drop sequence. This allows a create/drop sequence to work without any calls to "checkfirst", and also means with "checkfirst" turned on it only needs to check for the ENUM once. [ticket:2311]
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r--test/dialect/test_postgresql.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py
index 487139102..b4b7e818c 100644
--- a/test/dialect/test_postgresql.py
+++ b/test/dialect/test_postgresql.py
@@ -450,6 +450,30 @@ class EnumTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
finally:
metadata.drop_all(testing.db)
+ @testing.provide_metadata
+ def test_generate_multiple(self):
+ """Test that the same enum twice only generates once
+ for the create_all() call, without using checkfirst.
+
+ A 'memo' collection held by the DDL runner
+ now handles this.
+
+ """
+ metadata = self.metadata
+
+ e1 = Enum('one', 'two', 'three',
+ name="myenum")
+ t1 = Table('e1', metadata,
+ Column('c1', e1)
+ )
+
+ t2 = Table('e2', metadata,
+ Column('c1', e1)
+ )
+
+ metadata.create_all(checkfirst=False)
+ metadata.drop_all(checkfirst=False)
+
def test_non_native_dialect(self):
engine = engines.testing_engine()
engine.connect()