【问题标题】:Yii Rights module error after converting to postgres转换为 postgres 后 Yii Rights 模块错误
【发布时间】:2014-08-13 04:14:44
【问题描述】:

我已将我的应用程序数据库从 mysql 更改为 postgres,因为权限模块给出了异常:

`CDbCommand failed to execute the SQL statement: SQLSTATE[42P01]: Undefined table: 7 
 ERROR: relation "authitem" does not exist
LINE 2: FROM AuthItem t1
^. The SQL statement executed was: SELECT
name,t1.type,description,t1.bizrule,t1.data,weight
FROM AuthItem t1
LEFT JOIN Rights t2 ON name=itemname
ORDER BY t1.type DESC, weight ASC `

我已经查看了表格名称,它是完全相同的“区分大小写”。

【问题讨论】:

    标签: php mysql postgresql yii rights


    【解决方案1】:

    如果数据库中的表名是AuthItem 而不是authitem,则查询应该是:

    FROM "AuthItem" t1
    

    注意双引号。

    看起来无论您使用什么都将表创建为CREATE TABLE "AuthItem",但随后将其查询为SELECT ... FROM AuthItem。这些是不同的东西。是的,这很令人困惑,但这就是 SQL 标准所说的 - 在不带引号的标识符上 折叠,在带引号的标识符上 保留

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-22
      • 2021-11-15
      • 1970-01-01
      • 1970-01-01
      • 2017-05-03
      • 1970-01-01
      • 2021-11-18
      相关资源
      最近更新 更多