【发布时间】:2011-09-21 07:46:17
【问题描述】:
我有一个 Postgres 客户端发送类似的查询
SELECT ... FROM "public"."mycontent" "mycontent"
WHERE (strpos(substring("mycontent"."summary" from 1), 'search_string') + 1 - 1 > 0)
到我们的 Postgres 服务器。我希望客户端使用我的全文搜索功能,但我无法访问客户端的代码。所以我正在寻找一种方法来将上述形式的所有传入查询重写为:
SELECT ... FROM "public"."mycontent" "mycontent"
WHERE id in full_text_search('search_string')
注意'search_string' 的提取,因此此处不能使用 Postgres 规则,因为它们不进行此类提取。我希望任何人都知道任何可以进行查询重写的 postgres 中间件或代理,或者还有其他更好的主意吗?谢谢。
【问题讨论】:
-
理论上 RULE 是用来重写语句的,但我不认为他们可以通过查看 SQL 文本来确定是否应该重写。
标签: postgresql proxy middleware