gpt4 book ai didi

postgresql - 当生成器策略设置为 IDENTITY 时无法设置 sequenceGenerator

转载 作者:行者123 更新时间:2023-11-29 11:27:37 26 4
gpt4 key购买 nike

我正在尝试使用 PostgreSQL 的 IDENTITY 策略设置序列的分配大小和初始值。这不会产生我预期的 SQL,但是将策略更改为 SEQUENCE 是可行的。这是故意的吗?

id:
id:
type: integer
id: true
generator:
strategy: IDENTITY
sequenceGenerator:
sequenceName: table_id_seq
allocationSize: 10
initialValue: 100000

最佳答案

Doctrine 在 Doctrine\ORM\Mapping\ClassMetadataFactory 中初始化 ID 生成器策略.有一个很大switch工厂声明,切换<STRATEGY_NAME>您在 YAML 配置中提供:

generator:
strategy: <STRATEGY_NAME>

然后,选定的策略会从您的配置中获取更多可选参数。

Doctrine Manual 中列出了所有可用的策略. Sequence Generator 的选项策略详见 following subsection .

从您的配置来看,您当前正在为 Sequence Generator 设置参数策略,同时告诉 Doctrine 使用 Identifier战略。也许这是您遇到的意外行为?

您可以 read the source code 各自的工厂生产线,以阐明您的期望。

关于postgresql - 当生成器策略设置为 IDENTITY 时无法设置 sequenceGenerator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28664868/

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