Committed by Spencer Sun <[email protected]>

Subject: [DBD::Pg 1/2] Format our prepared statements with %x, not %d, for very 
long-running transactions in which the internal prepare_number rolls over into 
negative numbers - which bumps up against Postgres' rules about prepared 
statement names. Per RT #88827.

---
 dbdimp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dbdimp.c b/dbdimp.c
index f0a7032..b94d259 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -2136,7 +2136,7 @@ static int pg_st_prepare_statement (pTHX_ SV * sth, 
imp_sth_t * imp_sth)
        Renew(imp_sth->prepare_name, 25, char); /* freed in dbd_st_destroy */
 
        /* Name is "dbdpg_xPID_#", where x is 'p'ositive or 'n'egative */
-       sprintf(imp_sth->prepare_name,"dbdpg_%c%d_%d",
+       sprintf(imp_sth->prepare_name,"dbdpg_%c%d_%x",
                        (imp_dbh->pid_number < 0 ? 'n' : 'p'),
                        abs(imp_dbh->pid_number),
                        imp_dbh->prepare_number);
-- 
1.7.1

Reply via email to