我想设置to_tsvector
语言(例如:'French'),因此在渲染FTS向量时它会使用正确的字典。
表消息的locale_id
列位于locales
表中。然后,我需要将locales
表加入locale_id上的languages
表以获取实际的语言名称。但是我收到了一个含糊不清的;
错误:
select * from to_tsvector(t3.language, t1.message)
inner join message as t1
inner join locales as t2 on (t1.locale_id = t2.id)
inner join languages as t3 on (t2.language_id = t3.id);
错误:语法错误在“或”附近第1行:.... id)
内连接语言为t3 on(t2.language_id = t3.id);
答案 0 :(得分:0)
较新的代码:
select to_tsvector(t3.language, t1.message)
from message as t1
inner join locales as t2 on (t1.locale_id = t2.id)
inner join languages as t3 on (t2.language_id = t3.id);
原始修复:
select * from to_tsvector(t3.language, t1.message)
inner join message as t1 on 1 = 1 /* an ON join criteria is mandatory here even if you are doing an implicit cross join */
inner join locales as t2 on (t1.locale_id = t2.id)
inner join languages as t3 on (t2.language_id = t3.id);