Problem in 'select' from temp table with Perl/DBI

Поиск
Список
Период
Сортировка
От samik@cae.wisc.edu (Samik Raychaudhuri)
Тема Problem in 'select' from temp table with Perl/DBI
Дата
Msg-id fbf5e750.0111281921.55f0cd67@posting.google.com
обсуждение исходный текст
Ответы Re: Problem in 'select' from temp table with Perl/DBI  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,
I am using a temp table for a 'select' statement from a perl code
(using DBI) as follows:
==========================================
$query="select date_part('month', date) as month, date_part('year',
date) as year into temp counter from weblogs;
        select month || '-' || year, count(*) from counter group by
month, year;
        ";
$sth=$dbh->prepare($query) || die "Content-type:
text/plain\n\nCouldn't prepare select query: $query\n";
$sth->execute() || die "Content-type: text/plain\n\nCouldn't execute
statement: $query\n";
while(@data=$sth->fetchrow_array()){    push(@Datelog, [$data[0],
$data[1]]);   }
======================================

When I run this code, I get the following error message:
DBD::Pg::st execute failed: ERROR:  Relation 'counter' does not exist
at counter.pl line 56.
Content-type: text/plain

Couldn't execute statement:
select date_part('month', date) as month, date_part('year', date) as
year into temp counter from weblogs;
select month || '-' || year, count(*) from counter group by month,
year;

Line 56 is the 2nd select statement.
Can anybody give a hint about what can be wrong here?
Thanks and regards.
Samik

В списке pgsql-general по дате отправления:

Предыдущее
От: "xin"
Дата:
Сообщение: How many processes running on the server side, postmaster, backends, something else?
Следующее
От: Jan Wessely
Дата:
Сообщение: Current JDBC Driver char encoding - Bug or feature?