Re: debugging: prepared statement "dbdpg_7" already exists

"Greg Sabino Mullane" <greg-738XdyZ4GzZWk0Htik3J/[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> prepared statement "dbdpg_7" already exists

This is caused because a statement handle thinks that 7 is the next
available number, but someone else on the same connection has already
created it. The most likely cause is if you are using forks. If not,
then a repeatable test case would be great. There is one hack I am
considering adding that may fix it, but I need to verify the problem
first.

> Using a hash of the query itself would be a useful key, because that
> means it could originate on one of the front end web servers,
> and then be re-used by one of the other ones.

Not exactly sure what you mean here, as prepared statements don't cross
connections, but see $dbh->prepare_cached, as David mentioned.

> If also curious-- are there other syntaxes that work for setting
> pg_prepare_name, such as this: (?)
>
> $sth->prepare("SELECT 123", {pg_prepare_name => 'foo' });

No: the idea is to keep things like prepared names as transparent
and hands-off as possible, and leave the name juggling to DBD::Pg.
That's the theory anyway, it might be failing here. :)

> ( Unrelated, there a couple of typos in the docs where

Thanks, fixed.

- --
Greg Sabino Mullane greg-738XdyZ4GzZWk0Htik3J/[email protected]
PGP Key: 0x14964AC8 200605041524
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFEWlUsvJuQZxSWSsgRAt/IAJ9RQJv0CO69aXRSCZL1FfYcazcYJACg9RGp
iE1o+q4gmDAKnuxPJ5EaxeI=
=R7Ie
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.