I think the ANSI SQL standard is that the column name should be empty.  Any
other behavior is unportable.  Nothing wrong with a mention in the DBI docs
that authors writing portable DBI programs should avoid using the
driver-dependent names of unaliased derived expression columns.

On Fri, Jan 29, 2010 at 10:45 AM, Greg Sabino Mullane <g...@turnstep.com>wrote:

>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
> NotDashEscaped: You need GnuPG to verify this message
>
>
> >> The fact that count(*) shows up as "count" in the field name isn't
> driven by
> >> DBI - it's driver dependent.
> >
> > DBD::Pg     - "count"
> > DBD::Oracle - "count(*)"
> > DBD::Unify  - "count(*)"
> > DBD::CSV    - "count(*)"
> > DBD::SQLite - "count(*)"
> >
> > So IMHO a bug in DBD::Pg.
>
> Not so fast there. :) First, DBD::Pg is getting the column name from
> Postgres.
> Second, it may well be that Postgres is doing it *correct* and the other
> are wrong. Certainly not echoing a function's arguments as part of the
> column
> name seems a reasonable thing to do to me, legal or not.
>
> postgres=# select length('abcdef');
>  length
> --------
>      6
>
> mysql> select length('abcdef');
> +------------------+
> | length('abcdef') |
> +------------------+
> |                6 |
> +------------------+
>
> Well, at least they agree on the "6" :)
>
> --
> Greg Sabino Mullane g...@turnstep.com
> End Point Corporation http://www.endpoint.com/
> PGP Key: 0x14964AC8 201001291044
> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
>
> -----BEGIN PGP SIGNATURE-----
>
> iEYEAREDAAYFAktjAn8ACgkQvJuQZxSWSsjA3wCgsCdqJr5UkKtH/fbTRjgm3GPN
> 8pkAnjUOJd6N3WmalNy+qWz2D40f6Thq
> =UgkM
> -----END PGP SIGNATURE-----
>
>

Reply via email to