Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 72d4091

Browse files
author
Sergey Vasilyev
committed
Avoid indexing by columns that do not support indexing (JSON/JSONB)
1 parent e0aafc0 commit 72d4091

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_database_types.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,10 @@ def _create_table_with_indexes(conn, table_path, type_):
628628
else:
629629
conn.query(tbl.create())
630630

631-
if conn.dialect.SUPPORTS_INDEXES:
632-
(index_id,) = table_path
631+
(index_id,) = table_path
632+
if conn.dialect.SUPPORTS_INDEXES and type_ not in ('json', 'jsonb', 'array', 'struct'):
633633
conn.query(f"CREATE INDEX xa_{index_id} ON {table_name} ({quote('id')}, {quote('col')})")
634+
if conn.dialect.SUPPORTS_INDEXES:
634635
conn.query(f"CREATE INDEX xb_{index_id} ON {table_name} ({quote('id')})")
635636

636637
conn.query(commit)

0 commit comments

Comments
 (0)