-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

> Is there a way in DBI to get a $sth->rows count, when selecting to a
> temporary table?
>
> In this code I get a proper count from the SELECT, but the SELECT INTO
> TEMPORARY TABLE returns -1.

Short answer: no

Long DBD::Pg sepcific answer: SELECT is completely different from
SELECT INTO TABLE. The latter is really a variant of a CREATE TABLE statement
and thus is a DDL statement that does not return any rows. And while
SELECT COUNT(*) is pretty inefficient, so is ORDER BY random(), so for
small data sets this is fine, but for larger ones you might look at
rethinking the way you pull the random rows, which may lend itself to
an easier way to count rows along the way.


- --
Greg Sabino Mullane [EMAIL PROTECTED]
PGP Key: 0x14964AC8 200810311542
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkkLYFMACgkQvJuQZxSWSsgPXwCgpPJMbox/B3M364a1B44GeOIg
ft0AnR5lQOQhcbLVnaQkh+BmMTlLMbLY
=EvyR
-----END PGP SIGNATURE-----


Reply via email to