【问题标题】:Alter table query working on Postgres 12 but not Postgres 11. syntax error near "("更改在 Postgres 12 但不是 Postgres 11 上工作的表查询。“(”附近的语法错误
【发布时间】:2021-03-04 19:29:12
【问题描述】:

错误:

19:20:44.737 [info]  execute "ALTER TABLE listings\n       ADD COLUMN search_tsvector tsvector\n       GENERATED ALWAYS AS (to_tsvector('spanish', coalesce(title, '') || ' ' || coalesce(description, ''))) STORED;"
** (Postgrex.Error) ERROR 42601 (syntax_error) syntax error at or near "("

    query: ALTER TABLE listings
       ADD COLUMN search_tsvector tsvector
       GENERATED ALWAYS AS (to_tsvector('spanish', coalesce(title, '') || ' ' || coalesce(description, ''))) STORED;

此查询在我的 Postgres 12 上本地运行良好,但在我只能使用 Postgres 11 的服务器中,它无法成功运行。

有人可以帮忙吗?

【问题讨论】:

    标签: postgresql postgresql-11 postgresql-12


    【解决方案1】:

    Postgres 11 没有生成列,除了标识列:

    https://www.postgresql.org/docs/current/ddl-generated-columns.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-28
      • 2019-02-02
      • 2014-01-24
      • 2014-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多