Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gKqgq-00041P-5X for pgsql-admin@arkaria.postgresql.org; Thu, 08 Nov 2018 20:14:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gKqgm-0008Jm-O7 for pgsql-admin@arkaria.postgresql.org; Thu, 08 Nov 2018 20:14:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gKqgm-000879-9y for pgsql-admin@lists.postgresql.org; Thu, 08 Nov 2018 20:14:04 +0000 Received: from sonic309-14.consmr.mail.bf2.yahoo.com ([74.6.129.124]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gKqgh-0001fv-PW for pgsql-admin@postgresql.org; Thu, 08 Nov 2018 20:14:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1541708038; bh=0RViXtZGjlAOKJU5lXO4MAi/+QZakzmG5eQPDTMEV4k=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=hK1pa6rxoRKspl5pGX1O9Ky7PF82lHVo2PQHnsRHu9h4pM8tARmscCY1FLoap8rctZI3crNCPDMSzzMuzF/+H03/ldkbBmgnBmDBnJMa64BDnxvn1VsOcFy5LJvF0jIzHWtjbbex4yecmfKOeOm4dsxaYkz9KPbBWh1ouZFqx49phiZ0EwqbrVGiuIv/0oEYHNhWyauwIGk+hF4kA5nMaycqE85CseLQChcSdbPlVxC0AAwF+8IxlaT+jP30tshMwLBhmG2uB1VuhtxEClMWeXTzXfGoTrLEMjZjvwCRpVZKAkB8fDdNcF4ef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UhvxZPJ1YvTtF67QItywPe4Rok5vy1ZJKXGDbpHE- Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.bf2.yahoo.com with HTTP; Thu, 8 Nov 2018 20:13:58 +0000 Date: Thu, 8 Nov 2018 20:13:55 +0000 (UTC) From: Pepe TD Vo Reply-To: Pepe TD Vo To: Peter Eisentraut , Pgsql-admin Message-ID: <298826954.1145763.1541708035923@mail.yahoo.com> In-Reply-To: <1a281089-1cb6-7e69-645a-050505a45a88@2ndquadrant.com> References: <720744224.300433.1541599937254.ref@mail.yahoo.com> <720744224.300433.1541599937254@mail.yahoo.com> <1a281089-1cb6-7e69-645a-050505a45a88@2ndquadrant.com> Subject: Re: execute a procedure from another procudure? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1145762_1292327206.1541708035921" X-Mailer: WebService/1.1.12710 YahooMailNeo Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 Content-Length: 8874 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_1145762_1292327206.1541708035921 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I worked around with the transaction and it gives me no error and I assumed= it works. create or replace FUNCTION "CIDR_STAGING"."PR_WRITE_ERROR_LOG" ( v_os_user = IN varchar(4000), v_host IN=C2=A0varchar(4000), v_module IN varchar(4000), = v_errorcode IN int, v_errormsg IN varchar(4000) )=C2=A0=C2=A0RETURNS VOID= =C2=A0as $$ BEGIN START TRANSACTION;=C2=A0 =C2=A0insert into cidrmgmt.errorlog(=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0tstamp, os_user,host,module,errorcode,errormsg)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 values=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (c= urrent_timestamp, v_os_user, v_host, v_module, v_ErrorCode, v_ErrorMsg ); =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* commit; */ end;$$ LANGUAGE plpgsql; CREATE FUNCTION Query returned successfully in 107 msec.=C2=A0 thank you all.=C2=A0=C2=A0 Bach-Nga No one in this world is pure and perfect.=C2=A0 If you avoid people for the= ir mistakes you will be alone. So judge less, love and forgive more.To call= him a dog hardly seems to do him justice though in as much as he had four = legs, a tail, and barked, I admit he was, to all outward appearances. But t= o those who knew him well, he was a perfect gentleman (Hermione Gingold) **Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely = rich *** Faithful talent *** Sharing success=20 On Thursday, November 8, 2018 4:00 AM, Peter Eisentraut wrote: =20 On 07/11/2018 15:12, Pepe TD Vo wrote: > and I converted it to Postgres Pragma autonomous_transaction and I'm not > sure its corrected but it didn't give any error. PostgreSQL does not support autonomous transactions.=C2=A0 Some people use dblink as a workaround. --=20 Peter Eisentraut=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 http://www= .2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services =20 ------=_Part_1145762_1292327206.1541708035921 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I worked around with the tran= saction and it gives me no error and I assumed it works.

create or replace FUNCTION = "CIDR_STAGING"."PR_WRITE_ERROR_LOG" ( v_os_user IN varchar(4000), v_host IN=
 = varchar(4000), v_module IN varchar(4000), v_errorcode IN int, v_errormsg IN= varchar(4000) ) 
 RETURNS VOID 
as $$

BEGIN
=09START TRANSACTION;
   insert into cidrmgmt.errorlog(=
 =                     &nbs= p;  tstamp, os_user,host,module,errorcode,errormsg)
      &nbs= p; values
                (current_timesta= mp, v_os_user, v_host, v_module, v_ErrorCode, v_ErrorMsg );

        /* commit; */
=09=09<= /span>
= end;
$$= LANGUAGE plpgsql;

CR= EATE FUNCTION

Query returned successfully in 107 msec.
 
thank you all.  

Bach-Nga

No one in this world is pure and perfect.  If you avoid people for th= eir mistakes you will be alone. So judge less, love and forgive more.
To call him a dog hardly seems to do him justice tho= ugh in as much as he had four legs, a tail, and barked, I admit he was, to = all outward appearances. But to those who knew him well, he was a perfect g= entleman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.=
*** Genuinely rich *** Faithful talent *** Sharing success<= /span>


On Thurs= day, November 8, 2018 4:00 AM, Peter Eisentraut <peter.eisentraut@2ndqua= drant.com> wrote:


On 07/11/2018 15:12, Pepe TD Vo wrote:

> and I converted it t= o Postgres Pragma autonomous_transaction and I'm not
>= sure its corrected but it didn't give any error.

<= br clear=3D"none">PostgreSQL does not support autonomous transactions. = ; Some people use
dblink as a workaround.

--
Peter Eisentraut    &= nbsp;         http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Ser= vices




------=_Part_1145762_1292327206.1541708035921--