gpt4 book ai didi

php - CakePHP 使用错误的序列名称 (PostgreSQL)

转载 作者:行者123 更新时间:2023-11-29 12:00:39 24 4
gpt4 key购买 nike

当我尝试在 Postgres 表中保存一些信息时,CakePHP 为我返回了这个错误:

array(
(int) 0 => '[PDOException] SQLSTATE[42P01]: Undefined table: 7 ERRO: relação "public.cashier_transaction_transaction_num_seq" não existe
Request URL: /www/cashiers/open
Stack Trace:

但是 CakePHP 是正确的:这个序列不存在。正确的顺序是 transaction_num_seq

如何更改IN CAKE(我无法更改数据库)。

最佳答案

Postgres.php

中的 describe($model) 函数似乎使用了一个未记录的可选属性
if (isset($model->sequence)) {
$this->_sequenceMap[$table][$model->primaryKey] = $model->sequence;
}

像这样使用它来指定表的主键的顺序。

public class YourModel extends AppModel {
public $sequence = 'public.foobar_seq';
...
}

关于php - CakePHP 使用错误的序列名称 (PostgreSQL),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14965410/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com