Skip to content

Fix #2429: Replaced slow UNION query with optimized all_objects query #2467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,11 @@ def describe(name)
table_owner, table_name = default_owner, real_name
end
sql = <<~SQL.squish
SELECT owner, table_name, 'TABLE' name_type
FROM all_tables
WHERE owner = :table_owner
AND table_name = :table_name
UNION ALL
SELECT owner, view_name table_name, 'VIEW' name_type
FROM all_views
WHERE owner = :table_owner
AND view_name = :table_name
UNION ALL
SELECT table_owner, table_name, 'SYNONYM' name_type
FROM all_synonyms
WHERE owner = :table_owner
AND synonym_name = :table_name
UNION ALL
SELECT table_owner, table_name, 'SYNONYM' name_type
FROM all_synonyms
WHERE owner = 'PUBLIC'
AND synonym_name = :real_name
SELECT owner, object_name, object_type
FROM all_objects
WHERE owner = :table_owner
AND object_name = :table_name
AND object_type IN ('TABLE','VIEW','SYNONYM')
SQL
if result = _select_one(sql, "CONNECTION", [table_owner, table_name, table_owner, table_name, table_owner, table_name, real_name])
case result["name_type"]
Expand Down