Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 83017
Status: rejected
Priority: 0/
Queue: DBD-Pg

Owner: Nobody in particular
Requestors: purification [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

From purification [...] Mon Jan 28 17: 13:52 2013
MIME-Version: 1.0
X-Spam-Status: No, score=-6.334 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_HI=-5, SPF_SOFTFAIL=0.665] autolearn=ham
X-Spam-Flag: NO
Content-Type: text/plain; charset=UTF-8
Message-ID: <5106F811.5080209 [...]>
X-Virus-Scanned: Debian amavisd-new at
X-Spam-Score: -6.334
Received: from localhost (localhost []) by (Postfix) with ESMTP id 417BE240520 for <cpan-bug+DBD-Pg [...]>; Mon, 28 Jan 2013 17:13:52 -0500 (EST)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id OdJ0G9pqRgjj for <cpan-bug+DBD-Pg [...]>; Mon, 28 Jan 2013 17:13:49 -0500 (EST)
Received: from ( []) by (Postfix) with SMTP id 4166A24051E for <bug-DBD-Pg [...]>; Mon, 28 Jan 2013 17:13:48 -0500 (EST)
Received: (qmail 28252 invoked by uid 103); 28 Jan 2013 22:13:47 -0000
Received: from ( by with QMQP; 28 Jan 2013 22:13:47 -0000
Received: from (HELO ( by (qpsmtpd/0.84/v0.84-167-g4ed6cab) with ESMTP; Mon, 28 Jan 2013 14:13:43 -0800
Received: from [] (helo=[]) by with esmtpsa ID 1TzwxO-000HGH-62 for bug-DBD-Pg [...]; Tue, 29 Jan 2013 00:13:38 +0200
Authentication-Results: (amavisd-new); dkim=pass header.i= [...]
Delivered-To: cpan-bug+DBD-Pg [...]
Subject: [FEATURE REQUEST] DBD::Pg $sth with server-side prepares fails when executed in forked process due to unreliable prepare_name scheme
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12
Return-Path: <purification [...]>
X-RT-Mail-Extension: dbd-pg
X-Original-To: cpan-bug+DBD-Pg [...]
Dkim-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;; s=fsm; h=Content-Transfer-Encoding:Content-Type:Subject:To:MIME-Version:From:Date:Message-ID; bh=eBjBRwMDO6rQXTKKwBU4w/AtOsKa9GTKdaZwtEjDtXQ=; b=xRxgKFyZoL6EKBPQa/QDo9G1pfJLrIirQFyMEO3jCsVyxQRoBANq1VZHaY6qBm1IkROim116Z8QzuvK4VjyEaJGnL1JQVfmuulilOF5ucC87r0SC/wf5LJn3K/ksVZmqguTf7i7mWqTWwOXlhjeCf+HbQwjMRCukIf9Udk3dV78=;
Date: Tue, 29 Jan 2013 00:13:37 +0200
To: bug-DBD-Pg [...]
Content-Transfer-Encoding: 7bit
X-Enigmail-Version: 1.4.1
From: retaliation <purification [...]>
X-RT-Original-Encoding: utf-8
Content-Length: 583
Download (untitled) / with headers
text/plain 583b
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.
MIME-Version: 1.0
In-Reply-To: <5106F811.5080209 [...]>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <5106F811.5080209 [...]>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-13571-1360357215-498.83017-0-0 [...]>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 164
Download (untitled) / with headers
text/plain 164b
Not sure I understand - wouldn't forking create other problems? One cannot fork active database connections, as the messages will start interfering with each other.
MIME-Version: 1.0
In-Reply-To: <5106F811.5080209 [...]>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <5106F811.5080209 [...]>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.16-15718-1380576186-31.83017-0-0 [...]>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 190
Download (untitled) / with headers
text/plain 190b
DBI handles do not work across forks. Use something like DBIx::Connector to get around that -- but even still, you cannot prepare a statement handle in one process and execute it in another.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to