@@ -221,38 +221,6 @@ def test_ctas_with_data(adapter: Db2EngineAdapter, mocker: MockerFixture):
221221 assert "_subquery" not in sql_calls [0 ]
222222
223223
224- def test_ctas_with_table_description (adapter : Db2EngineAdapter , mocker : MockerFixture ):
225- """CTAS with table_description must not embed COMMENT= in the CREATE TABLE SQL.
226-
227- Db2 rejects inline COMMENT= in CTAS (SQL0104N). The description must be
228- applied via a separate COMMENT ON TABLE statement after the table is created.
229- """
230- mocker .patch .object (adapter , "table_exists" , return_value = False )
231- mocker .patch .object (adapter , "drop_view" )
232-
233- adapter .ctas (
234- table_name = "test_schema.test_table" ,
235- query_or_df = parse_one ("SELECT id FROM source_table" ),
236- exists = False ,
237- table_description = "test table description" ,
238- column_descriptions = {"id" : "test id column description" },
239- )
240-
241- sql_calls = to_sql_calls (adapter )
242- # First call: the CTAS itself — must contain WITH DATA and no inline COMMENT=
243- assert "CREATE TABLE" in sql_calls [0 ]
244- assert "WITH DATA" in sql_calls [0 ]
245- assert "COMMENT=" not in sql_calls [0 ].replace (" " , "" )
246- # Second call: separate COMMENT ON TABLE
247- assert any ("COMMENT ON TABLE" in c for c in sql_calls ), (
248- "Expected a separate COMMENT ON TABLE statement"
249- )
250- # Third call: separate COMMENT ON COLUMN
251- assert any ("COMMENT ON COLUMN" in c for c in sql_calls ), (
252- "Expected a separate COMMENT ON COLUMN statement"
253- )
254-
255-
256224# ---------------------------------------------------------------------------
257225# drop_view — guards via SYSCAT.VIEWS (no DROP VIEW IF EXISTS in Db2)
258226# ---------------------------------------------------------------------------
0 commit comments