Re: dynamic crosstab
От | Andy Colson |
---|---|
Тема | Re: dynamic crosstab |
Дата | |
Msg-id | 4B62FB5E.4020306@squeakycode.net обсуждение исходный текст |
Ответ на | Re: dynamic crosstab (Pierre Chevalier <pierre.chevalier1967@free.fr>) |
Список | pgsql-general |
On 1/28/2010 5:51 PM, Pierre Chevalier wrote: >> >> while ( my @list = $get->fetchrow_array) >> { >> print join(',', @list), "\n"; >> } > It throws some insulting messages, though: > > Use of uninitialized value $list[5] in join or string at > ./crosstab_perl.pl line 24. > Use of uninitialized value $list[6] in join or string at > ./crosstab_perl.pl line 24. > Use of uninitialized value $list[7] in join or string at > ./crosstab_perl.pl line 24. Yeah, you can ignore them. Fields that are null in the database will be converted to undef in perl, which when printed spits out that warning. Right before the print, we could test for undef and set them to empty string like: map { if (!defined($_)) {$_ = '';}} @list; so the while loop would look like: while ( my @list = $get->fetchrow_array) { map { if (!defined($_)) {$_ = '';}} @list; print join(',', @list), "\n"; } -Andy
В списке pgsql-general по дате отправления: