# "CHECK (((a > 1) AND (a < 5))) NOT VALID"
# "CHECK (some_boolean_function(a))"
# "CHECK (((a\n < 1)\n OR\n (a\n >= 5))\n)"
+ # "CHECK (a NOT NULL) NO INHERIT"
m = re.match(
- r"^CHECK *\((.+)\)( NOT VALID)?$", src, flags=re.DOTALL
+ r"^CHECK *\((.+)\)( NOT VALID)?( NO INHERIT)?$", src, flags=re.DOTALL
)
if not m:
util.warn("Could not parse CHECK constraint text: %r" % src)
],
)
+ def test_reflect_with_no_inherit_check_constraint(self):
+ rows = [
+ ("foo", "some name", "CHECK ((a IS NOT NULL)) NO INHERIT", None)
+ ]
+ conn = mock.Mock(
+ execute=lambda *arg, **kw: mock.MagicMock(
+ fetchall=lambda: rows, __iter__=lambda self: iter(rows)
+ )
+ )
+ check_constraints = testing.db.dialect.get_check_constraints(
+ conn, "foo"
+ )
+ eq_(
+ check_constraints,
+ [
+ {
+ "name": "some name",
+ "sqltext": "a IS NOT NULL",
+ "dialect_options": {"no_inherit": True},
+ "comment": None,
+ }
+ ],
+ )
+
def _apply_stm(self, connection, use_map):
if use_map:
return connection.execution_options(