Fixed #27323 -- Optimized Oracle introspection by using USER_SEQUENCES instead of USER_CATALOG.

This commit is contained in:
Mariusz Felisiak 2016-10-13 00:58:33 +02:00 committed by Tim Graham
parent 458e2fbfcc
commit 794f866cec
2 changed files with 4 additions and 4 deletions

View File

@ -54,8 +54,8 @@ END;
DECLARE
i INTEGER;
BEGIN
SELECT COUNT(*) INTO i FROM USER_CATALOG
WHERE TABLE_NAME = '%(sq_name)s' AND TABLE_TYPE = 'SEQUENCE';
SELECT COUNT(1) INTO i FROM USER_SEQUENCES
WHERE SEQUENCE_NAME = '%(sq_name)s';
IF i = 0 THEN
EXECUTE IMMEDIATE 'CREATE SEQUENCE "%(sq_name)s"';
END IF;

View File

@ -40,8 +40,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
DECLARE
i INTEGER;
BEGIN
SELECT COUNT(*) INTO i FROM USER_CATALOG
WHERE TABLE_NAME = '%(sq_name)s' AND TABLE_TYPE = 'SEQUENCE';
SELECT COUNT(1) INTO i FROM USER_SEQUENCES
WHERE SEQUENCE_NAME = '%(sq_name)s';
IF i = 1 THEN
EXECUTE IMMEDIATE 'DROP SEQUENCE "%(sq_name)s"';
END IF;