Subject: | [FEATURE REQUEST] DBD::Pg $sth with server-side prepares fails when executed in forked process due to unreliable prepare_name scheme |
Date: | Tue, 29 Jan 2013 00:13:37 +0200 |
To: | bug-DBD-Pg [...] rt.cpan.org |
From: | retaliation <purification [...] ukr.net> |
When $sth is prepared inside a forked process, and then executed
multiple times in a forked processes, it fails in a second and all next
calls due to forked process producing the same prepare_name.
The current code is as follows:
/* Name is "dbdpg_xPID_#", where x is 'p'ositive or 'n'egative */
sprintf(imp_sth->prepare_name,"dbdpg_%c%d_%d",
(imp_dbh->pid_number < 0 ? 'n' : 'p'),
abs(imp_dbh->pid_number),
imp_dbh->prepare_number);
I think it would be better if this code was replaced with a reliable
scheme, for example UUID-based.