summaryrefslogtreecommitdiff
path: root/test/dialect/test_postgresql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-10-20 17:28:08 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-10-20 17:28:08 -0400
commit60197fb0f4adc738a5f73a85d9c996b1259ea9e1 (patch)
treeb0a11221e106787d78cb34233cd53a86dfa2e98d /test/dialect/test_postgresql.py
parent466d6ed2f39d060d283d0732a39d7ce9f3f8a721 (diff)
downloadsqlalchemy-60197fb0f4adc738a5f73a85d9c996b1259ea9e1.tar.gz
- Fixed bug which prevented "domain" built from a
custom type such as "enum" from being reflected. [ticket:1933]
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r--test/dialect/test_postgresql.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py
index 36aa7f2c6..e20274aef 100644
--- a/test/dialect/test_postgresql.py
+++ b/test/dialect/test_postgresql.py
@@ -909,7 +909,10 @@ class DomainReflectionTest(TestBase, AssertsExecutionResults):
con = testing.db.connect()
for ddl in \
'CREATE DOMAIN testdomain INTEGER NOT NULL DEFAULT 42', \
- 'CREATE DOMAIN test_schema.testdomain INTEGER DEFAULT 0':
+ 'CREATE DOMAIN test_schema.testdomain INTEGER DEFAULT 0', \
+ "CREATE TYPE testtype AS ENUM ('test')", \
+ 'CREATE DOMAIN enumdomain AS testtype'\
+ :
try:
con.execute(ddl)
except exc.SQLError, e:
@@ -923,6 +926,8 @@ class DomainReflectionTest(TestBase, AssertsExecutionResults):
con.execute('CREATE TABLE crosschema (question integer, answer '
'test_schema.testdomain)')
+ con.execute('CREATE TABLE enum_test (id integer, data enumdomain)')
+
@classmethod
def teardown_class(cls):
con = testing.db.connect()
@@ -931,7 +936,10 @@ class DomainReflectionTest(TestBase, AssertsExecutionResults):
con.execute('DROP TABLE crosschema')
con.execute('DROP DOMAIN testdomain')
con.execute('DROP DOMAIN test_schema.testdomain')
-
+ con.execute("DROP TABLE enum_test")
+ con.execute("DROP DOMAIN enumdomain")
+ con.execute("DROP TYPE testtype")
+
def test_table_is_reflected(self):
metadata = MetaData(testing.db)
table = Table('testtable', metadata, autoload=True)
@@ -946,7 +954,15 @@ class DomainReflectionTest(TestBase, AssertsExecutionResults):
"Reflected default value didn't equal expected value")
assert not table.columns.answer.nullable, \
'Expected reflected column to not be nullable.'
-
+
+ def test_enum_domain_is_reflected(self):
+ metadata = MetaData(testing.db)
+ table = Table('enum_test', metadata, autoload=True)
+ eq_(
+ table.c.data.type.enums,
+ ('test', )
+ )
+
def test_table_is_reflected_test_schema(self):
metadata = MetaData(testing.db)
table = Table('testtable', metadata, autoload=True,
@@ -990,6 +1006,7 @@ class DomainReflectionTest(TestBase, AssertsExecutionResults):
finally:
postgresql.PGDialect.ischema_names = ischema_names
+
class MiscTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL):
__only_on__ = 'postgresql'