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 1g9f5M-0005nB-Ke for pgsql-general@arkaria.postgresql.org; Mon, 08 Oct 2018 23:37:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g9f5J-00076M-PQ for pgsql-general@arkaria.postgresql.org; Mon, 08 Oct 2018 23:37:09 +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 1g9f5J-00076F-Ha for pgsql-general@lists.postgresql.org; Mon, 08 Oct 2018 23:37:09 +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 1g9f58-0004Mn-Mt for pgsql-general@postgresql.org; Mon, 08 Oct 2018 23:37:09 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 698DD21D39; Mon, 8 Oct 2018 19:36:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 08 Oct 2018 19:36:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=c bI0ntdEm/MsypMHZDWcYPbsxZxV6yuCXwyZl5gHfJM=; b=LQYsWe2vnL4fBOryx YtMYPHxsKl9G+eMF1Ox7Ute7Sa6z8XdwJhaXW6G6WaCeIuhlheTEdEe5TeXAYYtY Lw6Bz3sSQfbernNzKHJ3KmbQXzqy2fzFTOXSE3nscHlZaSGw9cAgwTYpqMf5SImz 2o6afMvMOp7Ws+OgU2/zPxIpPezCZM2OIE0MXe/RB3dF9S9paj0WM6XNNF08bIYf xmmTQQ+FFDIYfIn6x5u3PKwXUjw1CAfDCx8JE16epqhf6X+IjfOifPq+GAxkH4dd 9o6PaGDEu8hDC9rijwY+yA+3Nx8DlJsY7LRxAVCEccUvWL0/q7mNgCZDKXt76ui1 yDV6Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=cbI0ntdEm/MsypMHZDWcYPbsxZxV6yuCXwyZl5gHf JM=; b=pEYLQpb1vG5wWZqcJFwCyCr2PQIV6MCaGx34vrs+tkfLfqgrP9J3yoYgF xitvDwhIFOreCt+aVvMsHra9JBzKKPD2ETJRGSal9fT5MmkYVVY5Hwo9nwSkgtHC Vd+4chyJsCjx6mb2T4LrakQtpgqSGYj/NTD+HuXK5UwDPHYGenmBdONZf7ntjOdX QfPIBC3ND4+uemffqX1XMTDuNv/3boxPEB+bkNe9sg571/wdiuapponY2tIe7FRM xKa+Kh9Lc3jT1JQfLx8izE3NwDjmJJtCU7eepqbijVPJyBNtqneZ6AzBEQRP6//z 6P4YFbt+RUaJZ+zHn6DO+kbxasulw== 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 93896E435E; Mon, 8 Oct 2018 19:36:54 -0400 (EDT) Subject: Re: FTS trigger works 1 at a time, but fails with bulk insert script To: Malik Rumi Cc: pgsql-general@postgresql.org References: <90aa688d-0e38-1f7e-f863-5a8d58fa4850@aklaver.com> From: Adrian Klaver Message-ID: <227ced50-8bb3-99b6-ce4d-77b97d396fdc@aklaver.com> Date: Mon, 8 Oct 2018 16:36:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <90aa688d-0e38-1f7e-f863-5a8d58fa4850@aklaver.com> 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/8/18 3:54 PM, Adrian Klaver wrote: > On 10/8/18 1:58 PM, Malik Rumi wrote: >> So what is the script you used to do the bulk INSERT? >> >> There's actually three, but they are all basically the same. The >> differences have to do with the source material being inserted: >> >> # usr/local/bin/python3.6 >> # coding: utf-8 >> >> from os import environ >> environ['DJANGO_SETTINGS_MODULE'] = 'chronicle.settings' >> import django >> django.setup() >> from ktab.models import Entry, Tag > > So I am going to assume Entry and Tag map to the tables ktab_entry and > public.ktab_entry_tags respectively. > >> from django.utils.text import slugify >> import csv >> >> >> filename = '/home/malikarumi/Projects/Progress_Logs/edit_blogpost.csv' >> >> with open(filename, 'rt') as text: >>      reader = csv.DictReader(text, delimiter=',') >>      # next(reader, None) >>      for row in reader: >>          my_entry = Entry.objects.create( >>              title=row['title'], slug=row['slug'], >> chron_date=row['created'], >>              clock=row['clock'], content=row['content']) >>          my_entry.tags.add(row['tag']) > > I thought that you needed to pass a model object to add(). If I am > following the above it is just a csv field value. > > Assuming log_statement = 'mod', I would tail the postgresql.conf file to > see what is actually hitting the database. Aargh, meant tail the Postgres log file. > > > >> */“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