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

From: samik(at)cae(dot)wisc(dot)edu (Samik Raychaudhuri)
To: pgsql-general(at)postgresql(dot)org
Subject: Problem in 'select' from temp table with Perl/DBI
Date: 2001-11-29 03:21:00
Message-ID: fbf5e750.0111281921.55f0cd67@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2001-11-29 05:02:45 Re: pg_dump and order of events
Previous Message xin 2001-11-29 03:13:58 How many processes running on the server side, postmaster, backends, something else?