yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

Improper loading of column schema for PgSQL #20210

Closed SOHELAHMED7 closed 3 months ago

SOHELAHMED7 commented 3 months ago

What steps will reproduce the problem?

I create table as:

Yii::$app->db->createCommand()->createTable('{{%arrs}}', [
            'id' => 'pk',
            'g5' => 'text[]',
        ])->execute();

And I want to generate migration code for same table (for create operation) while reading the yii\db\pgsql\ColumnSchema (Yii::$app->db->getTableSchema('{{%arrs}}', true)->columns)

What is the expected result?

I am able to see if g5 column it is array (text[])

What do you get instead?

I have no clue if g5 column is a array (text[])

Additional info

Q A
Yii version 2.0.?
PHP version
Operating system
SOHELAHMED7 commented 3 months ago

typcategory should be considered.

Proposed solution

image

image

Though this will fix issue only for array type category.

SOHELAHMED7 commented 3 months ago

Please ignore this issue for array as there is already dimension property

SOHELAHMED7 commented 3 months ago

Feel free to re-open this issue if anyone want supports for other rarely used data type categories. Also see https://github.com/Tigrov/yii2-pgsql if that solves your problem