Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHa5H-0007H2-26 for pgsql-general@arkaria.postgresql.org; Wed, 03 Mar 2021 22:35:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lHa5G-0000Bi-2W for pgsql-general@arkaria.postgresql.org; Wed, 03 Mar 2021 22:35:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHa5F-0000BX-PT for pgsql-general@lists.postgresql.org; Wed, 03 Mar 2021 22:35:09 +0000 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lHa5D-0003U6-3l for pgsql-general@lists.postgresql.org; Wed, 03 Mar 2021 22:35:09 +0000 Received: by mail-qt1-x82c.google.com with SMTP id r24so18924742qtt.8 for ; Wed, 03 Mar 2021 14:35:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding:content-language:thread-index; bh=6wyZAN+yVFUJMg1mnoZWE5qaY+KsKf+NLAyTXL8JJ1s=; b=BilArLgBSRgAvXuAOjTwCd6kpeHjn6seoVe5DHX6G4wfy1WOiBAIzTI08SkHt1ShUR L5NxhXzXhIHvMfQfvNzY/jaE4Axk/VSWTVqxOphNjiMNoiFwuZMkWbX0jYsMmWQTu5oT ghPu49hlfz/P2/rIp2IRYO1g//bCZJvXZvnUYcABPh8+Znb1l03kl80NfLutfLhsbh9O /Qi60ixE0mSXrfcLSM3dy8kjAs9PLTu409fZu8kYF1lWWEAuBeTNGr+gs3v8b8FRqHpY B+B5QUcGFSisU1CJP1D9/3wRTqEqdnPK05KAltqeENEBJAK2OcLxRndy6xIOlwPd2Mb0 0Pfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding:content-language:thread-index; bh=6wyZAN+yVFUJMg1mnoZWE5qaY+KsKf+NLAyTXL8JJ1s=; b=s0UrY8aMwl66hrBCTJROUH0U8SW2+SOpsbg11yCDLXnSffrSrTjnUjLuYVX7RH5ogf cUu9VCd1nc7LxUS9DddQ2rGfp72+u1lCCAyqs8fB62CVaT15TqSx6ntF5GyBmLJhDuZD iZuflBOL+zJqecGCjuru20QpUQ05TIPXDwTJP8xW2LPu+9xeA0Yaj6lzVvIKxIcXq1nB zGQqahd5/1+aWlPKR7jdQe689h+5Gh3PpVgyHuqvVkrUvNLKRwQfmE8owxbkzgGy3T2L 5oYeYZxBe7vqsF/OXUxvF6SujV2i7ne8Aasdswz1iZeDwsg2YFwixSJy9GulmDPZQRsm u8Kg== X-Gm-Message-State: AOAM53129eLQggmgmgKUMOmR1p4oSoZBh479CAj1r31FBWPV2VzlaBjl 9Jqs4a6oxLtTpY/L2FNMsFEoA+X0A1Q= X-Google-Smtp-Source: ABdhPJwu4sflKLuWtIoD3yQJdYIUv50Y7fj26Ap1Up9093LQYOWAvowMcwnqJgAS7wSMnhOOsFlPQQ== X-Received: by 2002:ac8:64c:: with SMTP id e12mr1459302qth.103.1614810905008; Wed, 03 Mar 2021 14:35:05 -0800 (PST) Received: from DESKTOPOL921RM ([190.183.58.215]) by smtp.gmail.com with ESMTPSA id 131sm17879591qkl.74.2021.03.03.14.35.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Mar 2021 14:35:04 -0800 (PST) From: "Fontana Daniel C. \(Desartec S.R.L.\)" To: Subject: Schema in trigger in logical replication Date: Wed, 3 Mar 2021 19:35:04 -0300 Message-ID: <003501d7107d$75a67a80$60f36f80$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Content-Language: es-ar Thread-Index: AdcQfR700zgYG8uVSyOJFjN5mgf0Bg== X-Antivirus: Avast (VPS 210303-0, 03/03/2021), Outbound message X-Antivirus-Status: Clean List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Using postgres 12.5 in DBA schema, this trigger is executed when the table is updated through a logical replication. Why is it necessary to name the schema for it to work? When I update the table manually, if it Works. Example. This trigger function does not work CREATE FUNCTION dba.ft_pos_sync_eco_tx() RETURNS trigger LANGUAGE 'plpgsql' COST 100 VOLATILE NOT LEAKPROOF AS $BODY$ begin INSERT INTO pos_sync_eco_rx ( id_terminales, fecha_y_hora_tx, fecha_y_hora_rx, dato, usuario, fecha_y_hora_proceso ) VALUES ( new.id_terminales, localtimestamp, localtimestamp, new.dato, new.usuario , localtimestamp ) ON CONFLICT (id_terminales) DO UPDATE SET (fecha_y_hora_tx, fecha_y_hora_rx, dato, usuario, fecha_y_hora_proceso ) =3D (new.fecha_y_hora_tx, localtimestamp, new.dato, new.usuario, new.fecha_y_hora_proceso ); return new; end $BODY$; This trigger function, if it works CREATE FUNCTION dba.ft_pos_sync_eco_tx() RETURNS trigger LANGUAGE 'plpgsql' COST 100 VOLATILE NOT LEAKPROOF AS $BODY$ begin INSERT INTO dba.pos_sync_eco_rx ( id_terminales, fecha_y_hora_tx, fecha_y_hora_rx, dato, usuario, fecha_y_hora_proceso ) VALUES ( new.id_terminales, localtimestamp, localtimestamp, new.dato, new.usuario , localtimestamp ) ON CONFLICT (id_terminales) DO UPDATE SET (fecha_y_hora_tx, fecha_y_hora_rx, dato, usuario, fecha_y_hora_proceso ) =3D (new.fecha_y_hora_tx, localtimestamp, new.dato, new.usuario, new.fecha_y_hora_proceso ); return new; end $BODY$; -- El software de antivirus Avast ha analizado este correo electr=C3=B3nico en= busca de virus. https://www.avast.com/antivirus