From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Kumar, Virendra <Virendra.Kumar@guycarp.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Running a Simple Update Statement Fails, Second Time Suceeds.
Date: Tue, 3 Sep 2019 14:32:09 -0700
Message-ID: <57a979ef-52a6-2b66-9be6-1b7623d53229@aklaver.com> (raw)
In-Reply-To: <68c971c331604cc68faf571d5ca287ed@USFKL11XG20CN01.mercer.com>
References: <68c971c331604cc68faf571d5ca287ed@USFKL11XG20CN01.mercer.com>
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
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, Virendra.Kumar@guycarp.com
Subject: Re: Running a Simple Update Statement Fails, Second Time Suceeds.
In-Reply-To: <57a979ef-52a6-2b66-9be6-1b7623d53229@aklaver.com>
References: <68c971c331604cc68faf571d5ca287ed@USFKL11XG20CN01.mercer.com> <57a979ef-52a6-2b66-9be6-1b7623d53229@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