FTS trigger works 1 at a time, but fails with bulk insert script

Поиск
Список
Период
Сортировка
От Malik Rumi
Тема FTS trigger works 1 at a time, but fails with bulk insert script
Дата
Msg-id CAKd6oBwLXpBU4sJwAokp_1gkhO38gYW__HpRtGWfWLcEOpT1MQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: FTS trigger works 1 at a time, but fails with bulk insert script  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
I have set up Postgres FTS on a Django/Python web site, and it works as expected except for this one thing. When I wrote a script to bulk insert legacy docs, the script works fine but the FTS trigger does not fire. I have to go back and open each document one at a time to get them indexed. 

What am I missing to make this work? Thanks.

            BEGIN
              SELECT setweight(to_tsvector(NEW.title), 'A') ||
                     setweight(to_tsvector(NEW.content), 'B') ||
                     setweight(to_tsvector(NEW.category), 'D') ||
                     setweight(to_tsvector(COALESCE(string_agg(tag.tag, ', '), '')), 'C')
              INTO NEW.search_vector
              FROM ktab_entry AS entry
                LEFT JOIN ktab_entry_tags AS entry_tags ON entry_tags.entry_id = entry.id
                LEFT JOIN ktab_tag AS tag ON tag.id = entry_tags.tag_id
              WHERE entry.id = NEW.id
              GROUP BY entry.id, category;
              RETURN NEW;
            END;


“None of you has faith until he loves for his brother or his neighbor what he loves for himself.”

В списке pgsql-general по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: Postgres 11 procedures and result sets
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: pg_sleep() inside plpgsql block - pro & cons