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 1i5GPc-0003Pb-CZ for pgsql-general@arkaria.postgresql.org; Tue, 03 Sep 2019 21:32:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i5GPa-0002Om-VQ for pgsql-general@arkaria.postgresql.org; Tue, 03 Sep 2019 21:32:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5GPY-0001wb-Uy for pgsql-general@lists.postgresql.org; Tue, 03 Sep 2019 21:32:26 +0000 Received: from [66.111.4.26] (helo=out2-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i5GPV-0006q2-RH for pgsql-general@lists.postgresql.org; Tue, 03 Sep 2019 21:32:23 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id CC85522131; Tue, 3 Sep 2019 17:32:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 03 Sep 2019 17:32:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=1 o2r7exHLw3ynwzDIFqIvEoUkHuhdFb9c8KzfN/FuS0=; b=vg7k9tdGeMLD+4w9o KMw4m01um4YLMSgptauIeQTZhAt91kwnu27fVmhqoVOYuj1pr6s7DuHfFSW9R4uL u3C3fDc3BxqYHxEqEq1uQAmCWdv+3B6AoQD1NTTVZMQ/mjy0y3j1eh2LteqVnUB6 t7xUrvRp6Z4F+tWc3G6Wb7xMIEgb77v81FDq4cLA7A+Iy7hng/3ilGNVFUqme5O1 xx6ViG5Mz80R3cQqvjzTKSIykxfIxULGc5/Lg1LSB8paGdlL9k+rQoRy3fc60HDh 0FIWHdwOaYHmWMjBx9ftkETcbdfBlaLgeyooKmFQdmHK3HsDbXwN6lkMf9VzHVY+ iszPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=1o2r7exHLw3ynwzDIFqIvEoUkHuhdFb9c8KzfN/Fu S0=; b=w1+rhGKnU6q98WuoM4LX1BN6Nq/98rSebe8MtEuYIay//ylQ5vnOFj0Nh Z3Es1kmoSxXbNuLOy4p7MD17avDlJrYKpYmT9kKVWTTprKl1VNDPysNR28bZ/g7k CHkR8mpynMZFQkfkr/WeHn2siDWx0c71zMa+itMi6/c7bBkImjoGD6lYzs/+knpm RMUGaxdzxMxE/3HsxoKvnvJL/cWYAZUrlPdzfygZy291zi1uFJdpTe+N/3nW691+ t779bw9/2bR3QgbJA/g7otFDkVkqDT0Z/0w5PRuRYDF8AJcFdQE43EMQbHIP1dqh DQEZflh0mSWuCxcFP5v83uw0LPSXA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudejfedgudefudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeehnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecukfhppeejgedrleegrdejfedrvddvvdenucfrrghrrghmpehmrghilhhfrhho mheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvg hrufhiiigvpedt X-ME-Proxy: Received: from ranger.suse (unknown [74.94.73.222]) by mail.messagingengine.com (Postfix) with ESMTPA id 113FAD6005F; Tue, 3 Sep 2019 17:32:09 -0400 (EDT) Subject: Re: Running a Simple Update Statement Fails, Second Time Suceeds. To: "Kumar, Virendra" , "pgsql-general@lists.postgresql.org" References: <68c971c331604cc68faf571d5ca287ed@USFKL11XG20CN01.mercer.com> From: Adrian Klaver Message-ID: <57a979ef-52a6-2b66-9be6-1b7623d53229@aklaver.com> Date: Tue, 3 Sep 2019 14:32:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <68c971c331604cc68faf571d5ca287ed@USFKL11XG20CN01.mercer.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.26 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/3/19 1:56 PM, Kumar, Virendra wrote: > Here is simple query, I am running via function call. This statement > runs fine as SQL but when put in function as plpgsql it failes with > error below, when I ran second times in same session it succeeds: We will need to see the function definition. > > -- > > product_master_fdw=> \set VERBOSITY verbose > > product_master_fdw=> > > select sddf_update.tps_update_1(p_pres_id_in=>50241::integer, > >                           p_last_audit_update_dt_in=>'2019-09-03 > 12:44:21.356638'::timestamp , > > > p_audit_update_user_name_tx_in=>'abc@xyz.com'::character varying, > > > p_major_class_name_tx_in=>'TEST0826222'::character varying, > >                           p_effective_dt_in=>CURRENT_TIMESTAMP::timestamp > >              ); > > ERROR:  XX000: cache lookup failed for type 196609 > > CONTEXT:  SQL statement "UPDATE product_history.external_sys_class_code_pres > >          SET class_code_id = > >                 CASE WHEN p_class_code_id_in='0.000000001' THEN > class_code_id  ELSE p_class_code_id_in END , > >              major_classification_cd = > >                 CASE WHEN p_major_classification_cd_in='.000000001' > THEN  major_classification_cd  ELSE p_major_classification_cd_in END , > >              major_classification_name_tx = > >                 CASE WHEN p_major_class_name_tx_in='0.000000001' THEN > major_classification_name_tx  ELSE p_major_class_name_tx_in END , > >              coverage_short_name_tx = > >                 CASE WHEN p_coverage_short_name_tx_in='0.000000001' > THEN  coverage_short_name_tx  ELSE p_coverage_short_name_tx_in END , > >              coverage_name_tx = > >                 CASE WHEN p_coverage_name_tx_in='0.000000001' THEN > coverage_name_tx  ELSE p_coverage_name_tx_in END , > >              cdt_source_system_cd = > >                 CASE WHEN p_cdt_source_system_cd_in='0.000000001' THEN > cdt_source_system_cd  ELSE p_cdt_source_system_cd_in END , > >              cdt_submitting_country_cd = > >                 CASE WHEN p_cdt_submitting_country_cd_in='0.000000001' > THEN  cdt_submitting_country_cd  ELSE p_cdt_submitting_country_cd_in END , > >              cdt_status_cd = > >                 CASE WHEN p_cdt_status_cd_in='0.000000001' THEN > cdt_status_cd  ELSE p_cdt_status_cd_in END , > >              effective_dt = > >                 CASE WHEN p_effective_dt_in=TO_DATE('01/01/1600', > 'mm/dd/yyyy') THEN  effective_dt  ELSE p_effective_dt_in END , > >              expiration_dt = > >                 CASE WHEN p_expiration_dt_in=TO_DATE('01/01/1600', > 'mm/dd/yyyy') THEN  expiration_dt  ELSE p_expiration_dt_in END , > >              audit_insert_user_name_tx = > >                 CASE WHEN p_audit_insert_user_name_tx_in='0.000000001' > THEN  audit_insert_user_name_tx  ELSE p_audit_insert_user_name_tx_in END , > >              audit_update_dt = CURRENT_TIMESTAMP, > >              audit_update_user_name_tx = > >                 CASE WHEN p_audit_update_user_name_tx_in='0.000000001' > THEN  audit_update_user_name_tx  ELSE p_audit_update_user_name_tx_in END , > >              latest_version_in = > >                 CASE WHEN p_latest_version_in_in='0' THEN > latest_version_in  ELSE p_latest_version_in_in END , > >              delete_in = > >                 CASE WHEN p_delete_in_in='0' THEN  delete_in  ELSE > p_delete_in_in END > >        WHERE pres_id = p_pres_id_in > >          AND audit_update_dt = p_last_audit_update_dt_in" > > PL/pgSQL function px_co_pr_pres_pg.spt_update_1(bigint,timestamp without > time zone,timestamp without time zone,character varying,character > varying,character varying,character varying,character varying,character > varying,character varying,character varying,character varying,character > varying,character varying,character varying,timestamp without time zone) > line 7 at SQL statement > > LOCATION:  getTypeOutputInfo, lsyscache.c:2681 > > Regards, > > Virendra > > > ------------------------------------------------------------------------ > > This message is intended only for the use of the addressee and may contain > information that is PRIVILEGED AND CONFIDENTIAL. > > If you are not the intended recipient, you are hereby notified that any > dissemination of this communication is strictly prohibited. If you have > received this communication in error, please erase all copies of the message > and its attachments and notify the sender immediately. Thank you. -- Adrian Klaver adrian.klaver@aklaver.com