DBI module weirdness

I am trying to do the following with a PostgreSQL database.

···

sql = <<ENDSQLCOMMAND
SELECT s.id, cwajga_magic_number((cwajga_product(r.rating) ^ (1 / 1)), MAX(lastplay.lastheard), 5) as magic
INTO TEMP magic_order
FROM song AS s LEFT OUTER JOIN rating AS r ON s.id = r.song LEFT OUTER JOIN last play ON lastplay.song = s.id
WHERE r.name ILIKE 'omega697’
GROUP BY s.id;

SELECT SUM(magic) as total INTO TEMP magic_tot FROM magic_order;

SELECT id, 100.0*magic/total as percent
FROM magic_order, magic_tot
order by percent;
ENDSQLCOMMAND

handle.execute(sql)

I get the following error:

DBI::ProgrammingError: ERROR: parser: parse error at or near “1” at
character 66

The thing is, when I enter this exact command into the psql command-line
program, it works fine.

cwajga_magic_number and cwajga_product are both plpython functions that
have been put into the database.

Am I doing something wrong? Or is there something wrong with DBI?

-Kurt

Please try version 0.0.20.
There was a bug in the "SQL parser" in previous versions.

Regards,

  Michael

···

On Tue, Aug 19, 2003 at 10:24:42AM +0900, Kurt M. Dresner wrote:

I am trying to do the following with a PostgreSQL database.

------------
sql = <<ENDSQLCOMMAND
SELECT s.id, cwajga_magic_number((cwajga_product(r.rating) ^ (1 / 1)), MAX(lastplay.lastheard), 5) as magic
INTO TEMP magic_order
FROM song AS s LEFT OUTER JOIN rating AS r ON s.id = r.song LEFT OUTER JOIN last play ON lastplay.song = s.id
WHERE r.name ILIKE 'omega697'
GROUP BY s.id;

SELECT SUM(magic) as total INTO TEMP magic_tot FROM magic_order;

SELECT id, 100.0*magic/total as percent
FROM magic_order, magic_tot
order by percent;
ENDSQLCOMMAND

handle.execute(sql)
------------

I get the following error:

DBI::ProgrammingError: ERROR: parser: parse error at or near "1" at
character 66

The thing is, when I enter this exact command into the psql command-line
program, it works fine.

cwajga_magic_number and cwajga_product are both plpython functions that
have been put into the database.

Am I doing something wrong? Or is there something wrong with DBI?