Skip Menu |

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

Report information
The Basics
Id: 71073
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: pavel.stehule [...] gmail.com
Cc:
AdminCc:

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



CC: Greg Sabino Mullane <greg [...] turnstep.com>
Subject: Re: support for returned rows for CREATE AS SELECT
Date: Mon, 19 Sep 2011 23:05:32 +0200
To: bug-DBD-Pg [...] rt.cpan.org
From: Pavel Stehule <pavel.stehule [...] gmail.com>
Hello we found a not consistent behave in current (and older) drivers for all platforms. A "do" method usually returns a number of processed rows. It support a INSERT, UPDATE, DELETE, SELECT. But it doesn't support a CREATE AS SELECT command. We found it when we migrate from MySQL, where DBI::mysql driver support it. Actually it returns nothing now - so some change should not break a backing compatibility. problematic statement: nrows = con->do("CREATE foo AS SELECT * FROM generate_series(1,10)"); nrows will be none after execution now, but it should be 10. This bug is important for us, because we can't to migrate from MySQL simply - our functionality depends on this feature - but we can use a patched driver. patch: *** ./dbdimp.c.orig 2011-05-09 17:42:15.000000000 +0200 --- ./dbdimp.c 2011-09-19 15:02:13.015872960 +0200 *************** *** 2813,2818 **** --- 2813,2821 ---- || 0 == strncmp(cmdStatus, "UPDATE", 6)) { rows = atoi(cmdStatus + 7); } + else if (0 == strncmp(cmdStatus, "SELECT", 6)) { + rows = atoi(cmdStatus + 7); + } break; case PGRES_COPY_OUT: case PGRES_COPY_IN Regards Pavel Stehule 2011/9/19 Greg Sabino Mullane <greg@turnstep.com>: Show quoted text
> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: RIPEMD160 > >
>> My colleagues  found a differences between MySQL and PostgreSQL driver >> when we work on migration from MySQL to PostgreSQL. The function >> "do(..)" doesn't return a processed rows for statement CREATE AS >> SELECT. I looked there and I found so this statement was not >> supported. A fix is relative simply:
> > Thanks, does indeed look simple. But could you please raise it > as a feature request at: > > https://rt.cpan.org/Public/Dist/Display.html?Name=DBD-Pg > > That way we have a record somewhere, other eyes can look at it, > and most importantly it won't fall through the cracks. > > - -- > Greg Sabino Mullane greg@turnstep.com > PGP Key: 0x14964AC8 201109191046 > http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 > -----BEGIN PGP SIGNATURE----- > > iEYEAREDAAYFAk53VbQACgkQvJuQZxSWSshUTQCdF9PRXd5xytks5znPChX7ugtA > sUYAoOnit2HGOyuCW8NFE1wzAjSbs95/ > =LoHE > -----END PGP SIGNATURE----- > > >
From: greg [...] turnstep.com
Thanks, applied in 1cd548fce5cff719e23da32fbf7c2eab37209a93 along with a test in 03dbmethod.t.