Skip to content

Schema.quoteColumnName() quoting problem #20535

@abolotin

Description

@abolotin

Hello

I have PG database with schema/table/column names containing upper cased symbols. I want to add condition, for example:

app."Applications"."Status" = ...

Using query builder in search model:

$query->andFilterWhere([
self::tableName() '.{{%Status}}' => $this->Status
]);

But resulting SQL contains condition: WHERE "Status"=...
This causes an error, because of SQL contains joins with another tables, whic also have own "Status" columns.

self::tableName() returns value: app.{{%Applications}}
As i understand, problem in yii\db\Schema, quoteColumnName($name) function. Code:

    if (strpos($name, '{{') !== false) {
        return $name;
    }

should be replaced with:

    if (strpos($name, '{{') !== false) {
        return $prefix . $name;
    }

???

Yii2 version 2.0.53

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions