public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nishant Sharma <[email protected]>
To: Mahendra Singh Thalor <[email protected]>
Cc: Shruthi Gowda <[email protected]>
Cc: Fujii Masao <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: PostgreSQL Development <[email protected]>
Subject: Re: [BUG] CRASH: ECPGprepared_statement() and ECPGdeallocate_all() when connection is NULL
Date: Tue, 24 Mar 2026 11:29:31 +0530
Message-ID: <CADrsxdbb2fn1LACQShrQT0bNqSCQ3hSzEojb2tODhD0PmewDiA@mail.gmail.com> (raw)
In-Reply-To: <CAKYtNAqjJbzV+ZJDqA-s0fHSLen6msc=A0SfrTS1ub1KKH9haQ@mail.gmail.com>
References: <CAASxf_P1F75Ck+0qyb10auT+BORupOM4yigXBnm7aWRNx1LYcA@mail.gmail.com>
	<[email protected]>
	<CAASxf_P5f=Frf8S7rN9BzphtCLoeN9vFuh-V7ukotOQZU54g+w@mail.gmail.com>
	<CAHGQGwHAPXexiGaHMkDDRF7cPBr_3fgCNdT4n2+1UjaEU++BAQ@mail.gmail.com>
	<CAASxf_OGWD7PA5TMEh2MdF2YxN8V3ByLhnFJ=uw0hKr33sgqAw@mail.gmail.com>
	<CAKYtNAqjJbzV+ZJDqA-s0fHSLen6msc=A0SfrTS1ub1KKH9haQ@mail.gmail.com>

Here are some review comments on v3 patch:-

   1.

   Change in descriptor.c file - In my opinion, we can use `if(conn)` with
   ecpg_raise, like other occurrence of ecpg_get_connection() call check in
   this file, and not using ecpg_init(). Three reasons: a) Consistency in
   checking conn after ecpg_get_connection() call in this file with if check.
   b) We don't need to remove 'ecpg_init_sqlca(sqlca);' line due to call to
   ecpg_init(). c) #2 comment below.
   2.

   If you agree with #1, then I see many other reasons for which
   ECPGget_desc() returns and we can avoid ecpg_get_connection() call at top
   of that function for those reasons and keep the check at the required
   location only instead of moving at top of the function.
   3.

   I see there is one more location of ecpg_get_connection() call where
   there is no check of NULL conn. In function ecpg_freeStmtCacheEntry() of
   file prepare.c? I understand it's not required for a call in
   ecpg_auto_prepare(), as the caller already validated that connection
   string. But I think, conn in ecpg_freeStmtCacheEntry() is different from
   the one that was validated.
   4.

   +1 to Mahindra, new test cases specific to the crash required for this
   change?



Regards,
Nishant Sharma,
EDB, Pune.
https://www.enterprisedb.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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [BUG] CRASH: ECPGprepared_statement() and ECPGdeallocate_all() when connection is NULL
  In-Reply-To: <CADrsxdbb2fn1LACQShrQT0bNqSCQ3hSzEojb2tODhD0PmewDiA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox