From 50e80fb5d6c525a937bbb43e5f9e97939c1a6938 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Sun, 13 Sep 2026 23:19:51 +0200 Subject: [PATCH] Reset object tables and types too USER_TABLES does not list object tables (CREATE TABLE ... OF some_type); only USER_OBJECT_TABLES / USER_ALL_TABLES do, while the dialect's reflection sees them like any other table. So one such leftover -- the driver's integration suite creates PYORACLE_AREF_PEOPLE OF PYORACLE_AREF_T when it shares the schema -- survived a reset and failed 41 ComponentReflectionTest cases that compare the whole table set, for a reason that looked like a driver bug. Two more kinds: object tables after the plain ones, and the types they are built on after them (a type in use by a table will not drop; FORCE first for a type referenced by another type, then the plain spelling). A backend without those dictionary views -- the Mirror over PostgreSQL -- reports them unavailable and carries on, as for the others. Verified on 11g: a planted object table + type and the driver suite's own leftovers, 8 of 8 dropped, nothing left in USER_OBJECTS; the Mirror-over-PG path still lists its plain tables. Co-Authored-By: Claude Fable 5.1 Signed-off-by: Peter Lemenkov --- test/reset_test_schema.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/reset_test_schema.py b/test/reset_test_schema.py index d841ddd..e14f1ca 100644 --- a/test/reset_test_schema.py +++ b/test/reset_test_schema.py @@ -38,6 +38,15 @@ # CASCADE CONSTRAINTS first, because on Oracle a table referenced by a foreign # key will not go without it; a Mirror in front of PostgreSQL rejects that # spelling (ORA-00900), so a plain DROP follows as the fallback. +# +# Object tables (CREATE TABLE ... OF some_type) are a kind of their own because +# USER_TABLES does not list them -- only USER_OBJECT_TABLES / USER_ALL_TABLES do +# -- while the dialect's reflection (ALL_TABLES) sees them like any other table. +# One such leftover, from a driver test suite sharing the schema, failed 41 +# ComponentReflectionTest cases that compare the whole table set. The types they +# are built on go after them (a type in use by a table will not drop) and +# before the sequences; FORCE first, because a type referenced by another type +# needs it, then the plain spelling for a backend without it. _KINDS = ( ('view', 'sys.user_views', ('DROP VIEW {name}',)), ( @@ -45,6 +54,12 @@ 'sys.user_tables', ('DROP TABLE {name} CASCADE CONSTRAINTS', 'DROP TABLE {name}'), ), + ( + 'object table', + 'sys.user_object_tables', + ('DROP TABLE {name} CASCADE CONSTRAINTS', 'DROP TABLE {name}'), + ), + ('type', 'sys.user_types', ('DROP TYPE {name} FORCE', 'DROP TYPE {name}')), ('sequence', 'sys.user_sequences', ('DROP SEQUENCE {name}',)), ) @@ -56,6 +71,8 @@ _NAME_COLUMN = { 'sys.user_views': 'view_name', 'sys.user_tables': 'table_name', + 'sys.user_object_tables': 'table_name', + 'sys.user_types': 'type_name', 'sys.user_sequences': 'sequence_name', }