Re: Duplicate fields in select_hashref

Jonathan Leffler <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Fri, Jan 29, 2010 at 7:45 AM, Greg Sabino Mullane <[email protected]>wrote:

> >> 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.
>
>
> postgres=# select length('abcdef');
>  length
> --------
>      6
>
> mysql> select length('abcdef');
> +------------------+
> | length('abcdef') |
> +------------------+
> |                6 |
> +------------------+
>
> Well, at least they agree on the "6" :)
>


For whatever it is worth - not a lot - Informix tags the COUNT(*) example
with 'count(*)' and gives '(constant)' for length('abcdef') and
'(expression)' for length(colname).  This is left up to the server and
different servers do things differently - you have to code correctly.  The
best way is to explicitly name every returned value with an AS clause.


-- 
Jonathan Leffler <[email protected]>  #include <disclaimer.h>
Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
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.