Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g7U5C-0005mo-26 for pgsql-general@arkaria.postgresql.org; Tue, 02 Oct 2018 23:28:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g7U59-0004KS-Iu for pgsql-general@arkaria.postgresql.org; Tue, 02 Oct 2018 23:27:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g7U57-0004KL-Q8 for pgsql-general@lists.postgresql.org; Tue, 02 Oct 2018 23:27:59 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g7U50-0004zc-EN for pgsql-general@postgresql.org; Tue, 02 Oct 2018 23:27:57 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BAC9521B84; Tue, 2 Oct 2018 19:27:47 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 02 Oct 2018 19:27:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=6OiGdbmOvblayY0/UNQGlIChZpxor lK7AMYvhWnIKgQ=; b=SHLUakqQDgqjVEjKOzypyA2rYckBSWs3J2OKjihF7Z5dk tVAX8nED51X2FalOsq93rpPwFJ8abQnkeAMeJlOETLhTxLPx9zJoJS4tEXePNeE1 2FLyxlnVcSnoFz7PcAJ42fHa6NIekmuxa9ywogMTVoZU7mlLzeNVg2F5bDt+aqcM l8Iyy2SfCBTuRMhvOIpLRISlkOyD9FSoUEgbBKhYjsobQT9BNnXv7kuTtd3elXES s180mfTnYB+CSTDMwwT5EMtSCyCAwIgeH3f7aSSYI+4zOdFka/ywLqhbKGzjKhOm QsPIfFlrVBy7FcOeWq6p4owMfEJoHeS8bbKrATIlw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=6OiGdb mOvblayY0/UNQGlIChZpxorlK7AMYvhWnIKgQ=; b=Ij26mvvcMTjEdI0qT9eQ4R Y8vznnK9rEtr9fXFrtK998mPGrww/Uh0ug2fS1OQPc1uNE00QjTd0aHfiMcW/L93 2XSOmcojhSIA5VH5JiAioPVt0SirUqxgSwe6DLrhKnTWLFl+OGFtWhsJ/1E4vb2Z ErVqplYGgUtb4bszuu20K86evxRVm3bFi+gjVbR8MZ95PU0i/w+qKXFntRj7sa1D gRkm3oUCpNyLMIuNMh89JHYq0mIb9Eo/3uzNnRZt25/RGsq33cVP66oD+TjlzUt7 XrIuHt4f8A7CYtzIN68cu8AWLGBM0ZKn38qEtuJdP+1txUlxyK5nfYdXNnUVPtdA == X-ME-Sender: X-ME-Proxy: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id 069D1102E0; Tue, 2 Oct 2018 19:27:46 -0400 (EDT) Subject: Re: FTS trigger works 1 at a time, but fails with bulk insert script To: Malik Rumi , pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: Date: Tue, 2 Oct 2018 16:27:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 >                 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.”/* -- Adrian Klaver adrian.klaver@aklaver.com