【发布时间】:2022-06-15 02:16:33
【问题描述】:
我想使用 Liquibase 将生成的列 https://www.postgresql.org/docs/current/ddl-generated-columns.html 添加到我的 PostgreSQL 表中。我已经尝试了所有想到的方法,甚至是:
- column:
computed: true
name: final_blows_death_ratio numeric GENERATED ALWAYS AS (CASE deaths WHEN 0 THEN 'NaN' ELSE TRUNC(final_blows::NUMERIC / deaths, 2) END) STORED
导致
Unexpected error running Liquibase: ERROR: syntax error at end of input
Position: 195 [Failed SQL: (0) ALTER TABLE public.overwatch_player_performances ADD "final_blows_death_ratio numeric GENERATED ALWAYS AS (CASE deaths WHEN 0 THEN 'NaN' ELSE TRUNC(final_blows::NUMERIC / deaths, 2) END) STORED"]
【问题讨论】:
-
PostgreSQL 对事情可能很挑剔。 [ALTER TABLE] (postgresql.org/docs/current/sql-altertable.html) 的 Oracle 文档应该有一些额外的上下文来帮助解决错误。如果仍然存在,请回复 ALTER TABLE 代码以便我们进行审核。
标签: postgresql liquibase