pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Mitar <mmitar@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Dropping and creating a trigger
Date: Sat, 5 Jan 2019 09:35:40 -0800
Message-ID: <7c439c51-c0ee-e219-3aae-22c08aad8f7a@aklaver.com> (raw)
In-Reply-To: <CAKLmikM3XbHJVRYcwLGAPknP5u6KfHjDinSpnrV07x46ozDwXw@mail.gmail.com>
References: <CAKLmikM3XbHJVRYcwLGAPknP5u6KfHjDinSpnrV07x46ozDwXw@mail.gmail.com>

On 1/5/19 1: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?

Works here:

  select version();
                                       version 
 

------------------------------------------------------------------------------------ 
 

  PostgreSQL 10.6 on x86_64-pc-linux-gnu, compiled by gcc (SUSE Linux) 
4.8.5, 64-bit

test=# begin;
BEGIN 
 

test=# drop trigger if exists test_trigger on trigger_test;
DROP TRIGGER 
 

test=# create trigger test_trigger  BEFORE INSERT ON trigger_test FOR 
EACH ROW WHEN (new.id > 10) EXECUTE PROCEDURE trigger_test() 

test-# ; 
 

NOTICE:  caught CREATE TRIGGER event on 'test_trigger on 
public.trigger_test' 

CREATE TRIGGER 
 

test=# commit ; 
 

COMMIT


So:

1) Postgres version?

2) Is this one of your 'temporary' trigger/function combos?

> 
> 
> Mitar
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (4+ messages)  latest in thread

Message-ID: <7c439c51-c0ee-e219-3aae-22c08aad8f7a@aklaver.com>
Permalink:  ../7c439c51-c0ee-e219-3aae-22c08aad8f7a@aklaver.com/
Also on:    postgresql.org/message-id/7c439c51-c0ee-e219-3aae-22c08aad8f7a@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, mmitar@gmail.com
  Subject: Re: Dropping and creating a trigger
  In-Reply-To: <7c439c51-c0ee-e219-3aae-22c08aad8f7a@aklaver.com>
  References: <CAKLmikM3XbHJVRYcwLGAPknP5u6KfHjDinSpnrV07x46ozDwXw@mail.gmail.com> <7c439c51-c0ee-e219-3aae-22c08aad8f7a@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