Yii2: Cannot access to tables in DB through ActiveRecord and Yii2 v2.0.33

Created on 26 Mar 2020  Â·  6Comments  Â·  Source: yiisoft/yii2

What steps will reproduce the problem?

Upgraded yii2 from 2.0.32 to 2.0.33

What is the expected result?

No changes in the access to DB.

What do you get instead?

I get

Invalid Configuration – yii\base\InvalidConfigException
The table does not exist: ****tablename***
in vendor/yiisoft/yii2/db/ActiveRecord.php on getTableSchema() function, line 438

for any table in the DB. The query create without ActiveRecord works.

Additional info

| Q | A
| ---------------- | ---
| Yii version | 2.0.33
| PHP version | 5.6.30-0+deb8u1
| Operating system |Debian 9
|DB type | ORACLE

Oracle bug

All 6 comments

Hi! I have a similar problem and errors in migrations.

In migrations error:

* applying m190304_110314_...
Exception: The table does not exist: {{%__tablename__}} (/app/vendor/yiisoft/yii2/db/ActiveRecord.php:438)

Our DBA specialist send trace log. In query two parameters have the same value (:schemaName and :tableName). Maybe problem in cache.

SELECT A.COLUMN_NAME, A.DATA_TYPE, A.DATA_PRECISION, A.DATA_SCALE, ( CASE A.CHAR_USED WHEN 'C' THEN A.CHAR_LENGTH ELSE A.DATA_LENGTH END ) AS DATA_LENGTH, A.NULLABLE, A.DATA_DEFAULT, COM.COMMENTS AS COLUMN_COMMENT FROM ALL_TAB_COLUMNS A INNER JOIN ALL_OBJECTS B ON B.OWNER = A.OWNER AND LTRIM(B.OBJECT_NAME) = LTRIM(A.TABLE_NAME) LEFT JOIN ALL_COL_COMMENTS COM ON (A.OWNER = COM.OWNER AND A.TABLE_NAME = COM.TABLE_NAME AND A.COLUMN_NAME = COM.COLUMN_NAME) WHERE A.OWNER = :schemaName AND B.OBJECT_TYPE IN ('TABLE', 'VIEW', 'MATERIALIZED VIEW') AND B.OBJECT_NAME = :tableName ORDER BY A.COLUMN_ID

  • Yii version - 2.0.33
  • PHP version - 7.1
  • DB - Oracle 12c

Likely connected with #17934. I'll push a fix #17938 to master in a few minutes.

Please try putting dev-master in your composer.json and updating.

With dev-master 8772548 the problem is still there.

If composer.lock like this

"name": "yiisoft/yii2",
            "version": "dev-master",
            "source": {
                "type": "git",
                "url": "https://github.com/yiisoft/yii2-framework.git",
                "reference": "e7b6656"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/e7b6656",
                "reference": "e7b6656",
                "shasum": ""
            },

means that I have e7b6656, the fix works!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chaintng picture chaintng  Â·  3Comments

AstRonin picture AstRonin  Â·  3Comments

skcn022 picture skcn022  Â·  3Comments

kminooie picture kminooie  Â·  3Comments

SamMousa picture SamMousa  Â·  3Comments