summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql/test_reflection.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-12-04 12:01:19 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-12-04 12:01:19 -0500
commit87bfcf91e9659893f17adf307090bc0a4a8a8f23 (patch)
treee36c7d4216ab1415f0b320ea581ab842ffd25726 /test/dialect/postgresql/test_reflection.py
parent156f473de00024688404d73aea305cd4fc452638 (diff)
downloadsqlalchemy-87bfcf91e9659893f17adf307090bc0a4a8a8f23.tar.gz
- The :meth:`.PGDialect.has_table` method will now query against
``pg_catalog.pg_table_is_visible(c.oid)``, rather than testing for an exact schema match, when the schema name is None; this so that the method will also illustrate that temporary tables are present. Note that this is a behavioral change, as Postgresql allows a non-temporary table to silently overwrite an existing temporary table of the same name, so this changes the behavior of ``checkfirst`` in that unusual scenario. fixes #3264
Diffstat (limited to 'test/dialect/postgresql/test_reflection.py')
-rw-r--r--test/dialect/postgresql/test_reflection.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_reflection.py b/test/dialect/postgresql/test_reflection.py
index 8de71216e..0dda1fa45 100644
--- a/test/dialect/postgresql/test_reflection.py
+++ b/test/dialect/postgresql/test_reflection.py
@@ -323,6 +323,18 @@ class ReflectionTest(fixtures.TestBase):
eq_([c.name for c in t2.primary_key], ['t_id'])
@testing.provide_metadata
+ def test_has_temporary_table(self):
+ assert not testing.db.has_table("some_temp_table")
+ user_tmp = Table(
+ "some_temp_table", self.metadata,
+ Column("id", Integer, primary_key=True),
+ Column('name', String(50)),
+ prefixes=['TEMPORARY']
+ )
+ user_tmp.create(testing.db)
+ assert testing.db.has_table("some_temp_table")
+
+ @testing.provide_metadata
def test_cross_schema_reflection_one(self):
meta1 = self.metadata