summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql/test_compiler.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-07-13 15:09:05 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-07-13 15:09:05 +0000
commitb64ecb03a5411dd5f32e40ac564bec9a886d3672 (patch)
tree046508ac3bcdc0b6f4f48f7b23972f632a35294d /test/dialect/postgresql/test_compiler.py
parent673ca806b323f47ef7064dd64ffc98240818b930 (diff)
parent0e46359cb00b453448e37ec16fce744f73c98581 (diff)
downloadsqlalchemy-b64ecb03a5411dd5f32e40ac564bec9a886d3672.tar.gz
Merge "Extract format_constraint truncation rules to ON CONFLICT"
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r--test/dialect/postgresql/test_compiler.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py
index 77b4242f1..cd360c2d4 100644
--- a/test/dialect/postgresql/test_compiler.py
+++ b/test/dialect/postgresql/test_compiler.py
@@ -2427,6 +2427,32 @@ class InsertOnConflictTest(fixtures.TestBase, AssertsCompiledSQL):
"DO NOTHING",
)
+ def test_do_nothing_super_long_name_constraint_target(self):
+ """test #6755"""
+
+ m = MetaData(
+ naming_convention={"uq": "%(table_name)s_%(column_0_N_name)s_key"}
+ )
+
+ uq = UniqueConstraint("some_column_name_thats_really_really_long_too")
+ Table(
+ "some_table_name_thats_really_really",
+ m,
+ Column("some_column_name_thats_really_really_long_too", Integer),
+ uq,
+ )
+
+ i = insert(self.table1, values=dict(name="foo"))
+
+ i = i.on_conflict_do_nothing(constraint=uq)
+ self.assert_compile(
+ i,
+ "INSERT INTO mytable (name) VALUES (%(name)s) ON CONFLICT "
+ "ON CONSTRAINT "
+ "some_table_name_thats_really_really_some_column_name_th_f7ab "
+ "DO NOTHING",
+ )
+
def test_do_nothing_quoted_named_constraint_target(self):
"""test #6696"""
i = insert(self.table1, values=dict(name="foo"))