I installed the latest image.module $Id: image.module,v 1.52 2003/07/22 15:11:12 killes Exp $ and get some errors when I go to the image module. I'm using postgres as database and checked the fields that are used in the query, they all exist in the table.

Is there anybody who can give me a hint where to look at?

warning: pg_exec() query failed: ERROR: Relation "n" does not exist
in /usr/local/lib/php/DB/pgsql.php on line 171.

user error: DB Error: unknown error
query:
SELECT created, thumb_path
FROM node n, image i
LEFT JOIN term_node t ON n.nid = t.nid
WHERE n.nid = i.nid
AND t.tid IN (92)
AND type = 'image'
AND personal = 0
ORDER BY created DESC
LIMIT 1
in /usr/local/apache/drupal/includes/database.pear.inc on line 89.

warning: pg_exec() query failed: ERROR: Relation "n" does not exist
in /usr/local/lib/php/DB/pgsql.php on line 171.

user error: DB Error: unknown error
query:
SELECT thumb_path
FROM node n, image i
LEFT JOIN term_node t ON n.nid = t.nid
WHERE n.nid = i.nid
AND t.tid IN (92)
AND type = 'image'
AND personal = 0
ORDER BY RAND()
LIMIT 1
in /usr/local/apache/drupal/includes/database.pear.inc on line 89.

warning: pg_exec() query failed: ERROR: Relation "n" does not exist
in /usr/local/lib/php/DB/pgsql.php on line 171.

user error: DB Error: unknown error
query:
SELECT created, thumb_path
FROM node n, image i
LEFT JOIN term_node t ON n.nid = t.nid
WHERE n.nid = i.nid
AND t.tid IN (91)
AND type = 'image'
AND personal = 0
ORDER BY created DESC
LIMIT 1
in /usr/local/apache/drupal/includes/database.pear.inc on line 89.

warning: pg_exec() query failed: ERROR: Relation "n" does not exist
in /usr/local/lib/php/DB/pgsql.php on line 171.

user error: DB Error: unknown error
query:
SELECT thumb_path
FROM node n, image i
LEFT JOIN term_node t ON n.nid = t.nid
WHERE n.nid = i.nid
AND t.tid IN (91)
AND type = 'image'
AND personal = 0
ORDER BY RAND()
LIMIT 1
in /usr/local/apache/drupal/includes/database.pear.inc on line 89.

Comments

killes@www.drop.org’s picture

I tried to fix these issues. Please try version 1.53.

erwin’s picture

Running v1.53 now and get the same error messages. I see some difference in the select statement.

Let me know if I can do some more tests.

killes@www.drop.org’s picture

Please send the error messages to me:

gerhard /at/ killesreiter dot de

killes@www.drop.org’s picture

I found an error, please try next version.

killes@www.drop.org’s picture

This error is only relevant if you use PostgreSQL. You can circumvent it my changeing all occurrences of RAND() to RANDOM(). Are better patch will become available later.

erwin’s picture

Changing RAND() into RANDOM() works fine now. All error messages mentioned above are gone, thanks.

bruno’s picture

Component: modules » Code

Following a patch made to update.php by Adrian, patch defining an RAND() function within PostgreSQL, it is no longer necessary to patch current CVS version of image.module.

However, for Drupal 4.2.0 users, a fix is available for the corresponding version of image.module.

Marking bug as fixed.

Anonymous’s picture

Automatically closed due to inactivity (marked fixed for 14 days).