更改适用于 Postgres 12 但不适用于 Postgres 11 的表查询“(”附近的语法错误

问题描述

错误

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',''))) STORED;

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

有人可以帮忙吗?

解决方法

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

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...