问题描述
错误:
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