Postgresql 如何使用返回记录集的函数运行嵌套查询?
如何使用返回记录集的函数运行嵌套查询 我想做的是解析文本字段并将其拆分为词干 应该是这样的Postgresql 如何使用返回记录集的函数运行嵌套查询?,postgresql,subquery,Postgresql,Subquery,如何使用返回记录集的函数运行嵌套查询 我想做的是解析文本字段并将其拆分为词干 应该是这样的 with strings as ( select text from messages where channel_id = 12345 and text like '%#%' ) select distinct token from ts_debug('russian', strings.text) where alias = 'word'; 但显然它不起作用,因为ts_deb
with strings as (
select text
from messages
where channel_id = 12345 and text like '%#%'
)
select distinct token
from ts_debug('russian', strings.text)
where alias = 'word';
但显然它不起作用,因为ts_debug返回记录集
如何执行此操作?从字符串中选择文本
还是加入
with strings as (
select text
from messages
where channel_id = 12345 and text like '%#%'
)
select distinct token
from strings
INNER JOIN ts_debug('russian', strings.text) AS tsd ON true
where alias = 'word';
使用横向连接:
with strings as (
select text
from messages
where channel_id = 12345 and text like '%#%'
)
select distinct td.token
from strings
cross join lateral ts_debug('russian', strings.text) as td
where alias = 'word';
with strings as (
select text
from messages
where channel_id = 12345 and text like '%#%'
)
select distinct td.token
from strings
cross join lateral ts_debug('russian', strings.text) as td
where alias = 'word';