Subject: | functions on computed columns aliased to the underlying column name are not called |
Using SQL-Statement-1.15, Perl 5.8.7 on cygwin 1.5.24 and Perl 5.8.8
on aix 5.2, queries like this:
select
rpad(foo_col, 7, '.') foo_col
from
foo_tbl
display results like this:
foo_col
-------
1
2
when I am expecting this:
foo_col
-------
1......
2......
The following patch fixes the behavior describe above:
$ diff -
ur /lib/perl5/site_perl/5.8/SQL/Statement.pm /patches/SQL/Statement.pm
--- /lib/perl5/site_perl/5.8/SQL/Statement.pm 2007-03-21
14:55:00.317514800 -0500
+++ /patches/SQL/Statement.pm 2007-03-21 17:44:03.448136400 -0500
@@ -840,7 +840,7 @@
$table->column_num($tbl . $dlm . $col) :
$table->column_num($col);
- if (!defined $cnum) {
+ if (!defined $cnum || $column->{function}) {
$funcs{$col} = $column->{function};
$cnum = $col;
}