diff --git a/framework/db/oci/Schema.php b/framework/db/oci/Schema.php index 82fbf8b..90824c0 100644 --- a/framework/db/oci/Schema.php +++ b/framework/db/oci/Schema.php @@ -253,22 +253,23 @@ SQL; protected function findConstraints($table) { $sql = <<db->createCommand($sql, [ ':tableName' => $table->name, ':schemaName' => $table->schemaName, ]); + $constraints = []; foreach ($command->queryAll() as $row) { if ($this->db->slavePdo->getAttribute(\PDO::ATTR_CASE) === \PDO::CASE_LOWER) { $row = array_change_key_case($row, CASE_UPPER); diff --git a/framework/db/pgsql/Schema.php b/framework/db/pgsql/Schema.php index b700164..e547f8d 100644 --- a/framework/db/pgsql/Schema.php +++ b/framework/db/pgsql/Schema.php @@ -180,7 +180,7 @@ class Schema extends \yii\db\Schema SELECT c.relname AS table_name FROM pg_class c INNER JOIN pg_namespace ns ON ns.oid = c.relnamespace -WHERE ns.nspname = :schema AND c.relkind IN ('r','v','m','f') +WHERE ns.nspname = :schemaName AND c.relkind IN ('r','v','m','f') ORDER BY c.relname SQL; $command = $this->db->createCommand($sql, [':schemaName' => $schema]); diff --git a/tests/unit/data/oci.sql b/tests/unit/data/oci.sql index 32f09c3..cf8736f 100644 --- a/tests/unit/data/oci.sql +++ b/tests/unit/data/oci.sql @@ -18,6 +18,7 @@ BEGIN EXECUTE IMMEDIATE 'DROP TABLE "null_values"'; EXCEPTION WHEN OTHERS THEN I BEGIN EXECUTE IMMEDIATE 'DROP TABLE "constraints"'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;-- BEGIN EXECUTE IMMEDIATE 'DROP TABLE "bool_values"'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;-- BEGIN EXECUTE IMMEDIATE 'DROP TABLE "animal"'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;-- +BEGIN EXECUTE IMMEDIATE 'DROP VIEW "animal_view"'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;-- BEGIN EXECUTE IMMEDIATE 'DROP TABLE "validator_main"'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;-- BEGIN EXECUTE IMMEDIATE 'DROP TABLE "validator_ref"'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;-- @@ -161,6 +162,8 @@ CREATE TABLE "animal" ( ); CREATE SEQUENCE "animal_SEQ"; +CREATE VIEW "animal_view" AS SELECT * FROM "animal"; + /** * (Postgres-)Database Schema for validator tests */