pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Malik Rumi <malik.a.rumi@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: FTS trigger works 1 at a time, but fails with bulk insert script
Date: Tue, 2 Oct 2018 16:27:46 -0700
Message-ID: <ff45112f-48a7-3384-7b5c-18f31ef5e5e0@aklaver.com> (raw)
In-Reply-To: <CAKd6oBwLXpBU4sJwAokp_1gkhO38gYW__HpRtGWfWLcEOpT1MQ@mail.gmail.com>
References: <CAKd6oBwLXpBU4sJwAokp_1gkhO38gYW__HpRtGWfWLcEOpT1MQ@mail.gmail.com>

On 10/2/18 10:34 AM, Malik Rumi wrote:
> 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.

Have no idea as there is not enough information.

To begin with:

1) What is code below?

2) What is the trigger definition and on what table?

3) What is the function the trigger is calling?

4) For good measure what version of Postgres?

> 
>              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 <http://entry.id;
>                  LEFT JOIN ktab_tag AS tag ON tag.id <http://tag.id; = 
> entry_tags.tag_id
>                WHERE entry.id <http://entry.id; = NEW.id
>                GROUP BY entry.id <http://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.”/*


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (11+ messages)  latest in thread

Message-ID: <ff45112f-48a7-3384-7b5c-18f31ef5e5e0@aklaver.com>
Permalink:  ../ff45112f-48a7-3384-7b5c-18f31ef5e5e0@aklaver.com/
Also on:    postgresql.org/message-id/ff45112f-48a7-3384-7b5c-18f31ef5e5e0@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, malik.a.rumi@gmail.com
  Subject: Re: FTS trigger works 1 at a time, but fails with bulk insert script
  In-Reply-To: <ff45112f-48a7-3384-7b5c-18f31ef5e5e0@aklaver.com>
  References: <CAKd6oBwLXpBU4sJwAokp_1gkhO38gYW__HpRtGWfWLcEOpT1MQ@mail.gmail.com> <ff45112f-48a7-3384-7b5c-18f31ef5e5e0@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox