Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfj03-0008Pm-1o for pgsql-general@arkaria.postgresql.org; Sat, 05 Jan 2019 10:16:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gfj01-00075q-BS for pgsql-general@arkaria.postgresql.org; Sat, 05 Jan 2019 10:16:13 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfj01-000738-0e for pgsql-general@lists.postgresql.org; Sat, 05 Jan 2019 10:16:13 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfizz-0001KX-0x for pgsql-general@lists.postgresql.org; Sat, 05 Jan 2019 10:16:12 +0000 Received: by mail-wr1-x42c.google.com with SMTP id z5so38618300wrt.11 for ; Sat, 05 Jan 2019 02:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=wssWsBKbVi45dTYY05CC22+ypDtHNRGhcqdYfVqHlIk=; b=qgCvfYCHEswXGdhXSLAlvGyi3xNU3IDKe8X4ckrs7/l/HUhedP7dVOhGlnWkrnPEQh A9WpPR7KIdV4dNUBa0A1z4NIP/r57mnX7U0wTKAMMjHUFpwYlerxvwYXwfjcdDXEHoTW FqRDeRkFK/nKa2o/HU/dl60WRBMcdWW4QUikAY99BSzWedW2NHw3sfGJM1qt5hDjUQ1M A1C+Dpk17R0FtvAPGSqrY9Czp9n+MBKuZKv7Dq3QSRWat5INDV521j9GAwbHLs6mw6qE vH/5dbvJuszV7USHbHLmjsU96cHch8qmZs6f1uV96GgJpOOA+lx3TML7cMevgxG/TyA1 t49w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=wssWsBKbVi45dTYY05CC22+ypDtHNRGhcqdYfVqHlIk=; b=gBlWfzj77QxJtDGK+hKpNFDpRFAY4mLzBLuypiNy0/rPkS5oW9h7vCZQvTgrrXor6A qbNrEU2O2P/86b0fSaSiQ34briOl0gdPNlcRJtD6Zz54rf2Tn6x7dXlWCuAV5ZIc9drh fdowFKM5BMmLv9akqO8TeY40j3IeAz6pFFjfywL5sgucg5/bhS5vvIix5+xCH3mY2cQo gJhtpk1ivk7V3bZsQbae6EhIOFqYOrFOb4iofscNhAEyoSkbep5eA0A8MsAo6GZTMVEQ Eu5vi8OFsGR83EqfjO4aEAsQ+/Wkaxn0+tSAQ1oQb1lEQa1sfGmPgGnz9e8bY+dgi6eS /vRw== X-Gm-Message-State: AJcUukdoOTn2lK+4xI3ihuNuLRtt//jwVEoCZ1jrXzGjVH5q5ft0RAQI D6xiXgg/+WnyV3wWQFhv+0MkjEzn X-Google-Smtp-Source: ALg8bN4kuY/DDz8Juk8PSWYV+OdHbb8DAmdMZ7tkUsyP99u/RK1aHYxHNJ0MRB8srpxhRX7/MRGv7Q== X-Received: by 2002:adf:e64d:: with SMTP id b13mr48006646wrn.276.1546683368989; Sat, 05 Jan 2019 02:16:08 -0800 (PST) Received: from [10.30.10.6] ([172.98.67.77]) by smtp.googlemail.com with ESMTPSA id p139sm5576183wmd.31.2019.01.05.02.16.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Jan 2019 02:16:08 -0800 (PST) Subject: Re: Dropping and creating a trigger To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <46b0ab1f-d072-43d1-603b-d3b18f24028a@gmail.com> Date: Sat, 5 Jan 2019 04:16:06 -0600 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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/5/19 3:59 AM, Mitar wrote: > Hi! > > I am seeing such errors in logs: > > ERROR: trigger "myapp_assignments" for relation "assignments" already exists > STATEMENT: > BEGIN TRANSACTION; > DROP TRIGGER IF EXISTS "myapp_assignments" ON "assignments"; > CREATE TRIGGER "myapp_assignments" > AFTER INSERT OR UPDATE OR DELETE ON "assignments" > FOR EACH ROW EXECUTE PROCEDURE "tblobs_myapp"(); > COMMIT; > > How is this possible? If I am inside a transaction, this should work, no? I'd think it should.  Have you run the commands manually, one at a time, from psql, and checking the table after the DROP TRIGGER, to verify that the trigger actually gets dropped? -- Angular momentum makes the world go 'round.