The following bug has been logged on the website:
Bug reference: 15051
Logged by: Alexander Konstantinov
Email address: alkonstantinov@outlook.com
PostgreSQL version: 10.0
Operating system: Ubuntu
Description:
This is additional information to bug #15040
This is the loop in the end of the function which does RETURN NEXT:
FOR ord , doc_id, score , titles, org_id, langs, thematics, doctype,
from_dt, to_dt, dtad_from, dtad_to, dtterm_from, dtterm_to, dtif_from,
dtif_to IN
SELECT t.id , t.doc_id, t.score, jsonb_agg(d.title)/*, t.excerpt*/,
t.org_id, t.langs::jsonb, t.thematics::jsonb, d.typ, t.from_dt::date,
t.to_dt::date,
t.dtad_from::date, t.dtad_to::date, t.dtterm_from::date,
t.dtterm_to::date, t.dtif_from::date, t.dtif_to::date
FROM _t t JOIN lucy.vw_docs_txt_mat d ON t.doc_id = d.doc_id
GROUP BY t.id, t.doc_id, t.score, d.typ
ORDER BY t.id-- DESC
OFFSET _offset LIMIT _count
LOOP
SELECT INTO _ex t.excerpt FROM _t t WHERE t.id = ord;
-- SELECT INTO excerpt _ex; -- Doesn't work
-- SELECT INTO excerpt _ex::varchar; -- Works if field is of type
varchar(text)
SELECT INTO excerpt _ex::varchar::jsonb; -- works!!!, and _ex е is of
type jsonb???
RETURN NEXT;
END LOOP;