right after I submitted a new project, I got this user warning..

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'prsv.snapshot = 1 ORDER BY td.weight, td.name, r.version_major DESC, r.version_' at line 1 query: SELECT n.nid, n.created, tn.tid, td.name as api_term_name, prsv.supported, prsv.recommended, prsv.snapshot, r.* FROM node n INNER JOIN project_release_nodes r ON r.nid = n.nid INNER JOIN term_node tn ON n.nid = tn.nid AND tn.tid in (15,19) INNER JOIN term_data td ON td.tid = tn.tid INNER JOIN project_release_supported_versions prsv ON prsv.nid = r.pid AND prsv.tid = tn.tid AND prsv.major = r.version_major AND prsv.supported = 1 WHERE (r.pid = 22) AND (n.status = 1) AND r.rebuild = 1AND prsv.snapshot = 1 ORDER BY td.weight, td.name, r.version_major DESC, r.version_minor DESC, r.version_patch DESC, r.file_date DESC in D:\www\pj\includes\database.mysql.inc on line 172.

Comments

trunksye’s picture

I just found out it was here " r.rebuild = 1AND" that triggered the error.

wonder how I could patch it. I can't find any smiliar sql queries in modules/project folder. :(

trunksye’s picture

I got it. it's in the file project_release.module, line 1698 " $where .= 'AND prsv.snapshot = 1';"
add a space before AND shall fix the problem

aclight’s picture

Status: Active » Postponed (maintainer needs more info)

Hm....I don't think you're using project version 5.x-1.2, unless you've patched the project_release.module file elsewhere. I don't see $where .= 'AND prsv.snapshot = 1'; anywhere in project_release.module in 5.x-1.2 or in HEAD (see http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/project/rel...).

Are you using a patched version? If not, can you paste the $Id:$ line from the top of the file.

trunksye’s picture

here they are

// $Id: project_release.module,v 1.66 2008/03/07 19:35:08 dww Exp $
// $Name: DRUPAL-5--1-2 $

I probably am using a patched file from drupal forum coz I have been experimenting project management with drupal and stumbled upon quite a few errors.

anyway , now it seems working fine for me . this issue should probably be set to closed or deleted.

aclight’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

setting to by design. please re-open if you can confirm that this problem is not due to a patch you've applied to the module.

ggrell@drupal.org’s picture

Status: Closed (works as designed) » Active

I just ran into the same or similar problem. Fresh install of drupal, project 5.x-1.2 (along with organic groups). Here's the error I got when adding the project:

user warning: Unknown column 'prsv.snapshot' in 'where clause' query: SELECT DISTINCT(n.nid), n.created, r.* FROM node n INNER JOIN project_release_nodes r ON r.nid = n.nid WHERE (r.pid = 3) AND (n.status = 1) AND r.rebuild = 1 AND prsv.snapshot = 1 ORDER BY r.version_major DESC, r.version_minor DESC, r.version_patch DESC, r.file_date DESC in C:\wamp\www\drupal5\includes\database.mysql.inc on line 172.

Running on an install of wamp 2.0.

aclight’s picture

@ggrell@drupal.org: This is not the right issue for the problem you report. You want #231614: Project release should handle case where api terms are not defined.

Setting status back to where it was before.

cquest’s picture

Status: Active » Needs review

This SQL error seems to come from project_release_table in project_release.module.

Around line 1696, we have:

$where = ' AND r.rebuild = 1 AND prsv.snapshot = 1 ';

But prsv may not defined by any JOIN clause in some cases.

I've added the following right after the above line (copied from line 1677):

if (!$tids) $join .= ' INNER JOIN {project_release_supported_versions} prsv ON prsv.nid = r.pid AND prsv.tid = tn.tid AND prsv.major = r.version_major ';

This solved the problem for me (no more error), but I'm not sure it is not creating some other as I don't understand the whole logic of the release/snapshots things.

aclight’s picture

Status: Needs review » Closed (works as designed)

@cquest: I think you also want #231614: Project release should handle case where api terms are not defined, which has now been fixed.