OK. This Error has probably been reported but I could not find it. Anyway I have a problem. When the carousel runs as admin, the error message before does not appear. As an ordinary user, the error message appears below. I disabled gmaps, and the error was there. I'm a bit lost. Any solutions?

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT count(node.nid) FROM node node LEFT JOIN gmap_latlon gmap_latlon_field_location_0 ON node.vid = gmap_latlon_field_location_0.vid AND gmap_latlon_field_location_0.field_name = 'field_location_0' INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all'))) AND ( (node.type IN ('event')) ) in /***/***/htdocs/includes/database.mysql.inc on line 172.

Thanks.

Kahenya

Comments

dave reid’s picture

Looks like it should be node.nid. The node table isn't given the 'n' table alias.

dave reid’s picture

Title: MySQL Not??? » SQL Error: Unknown column 'n.nid'
summit’s picture

Hi,
I do not think is should be node.nid.
I think this is causing by a mistake of the query as: http://drupal.org/node/51696
It happens when you have access module inserting in the module query is my investigation.
I myself have still also errors like this after going for domain access.

So you have to find the query and rewrite it as described in attached link, I think.

greetings,
Martijn

kevin hankens’s picture

Actually, I would agree with Dave Reid.

This code:SELECT count(node.nid) FROM node node...

Queries the table "node" and gives it an alias of "node". But, INNER JOIN node_access na ON na.nid = n.nid is trying to do a join on table (or alias) "n", which hasn't been defined.

Try changing the JOIN statement to INNER JOIN node_access na ON na.nid = node.nid

Good luck!

jcfiala’s picture

Status: Active » Closed (won't fix)

I don't have any references to gmap code in nodecarousel, so this is most likely a SQL query that you or some other part of the code is constructing, not the nodecarousel. I suggest doing a search for this query and correctin git.

summit’s picture

problem is, as I tried to describe that probably the

INNER JOIN node_access na ON na.nid = n.nid 

is from the access usage, I do not think altering this is the way to go.

greetings,
Martijn

dave reid’s picture

Project: Nodecarousel » GMap Lat/Lon
Version: 5.x-1.x-dev » 5.x-0.1
Status: Closed (won't fix) » Active

The only module I can find with the gmap_latlon table is (duh) the GMap Lat/Lon module. Moving this issue to that module's issue queue.

Anonymous’s picture

Project: GMap Lat/Lon » Nodecarousel
Version: 5.x-0.1 » 5.x-1.x-dev

Returning to Nodecarousel

Hi,

Sorry away 2 days for Off line Forum

Even with all the other modules disabled. I still get the error below

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT count(node.nid) FROM node node INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all'))) AND ( (node.type IN ('event')) ) in /***/***/***/includes/database.mysql.inc on line 172.

I have even removed the modules, run nodecarousel on a sterile Drupal with the bare minimums and get the same error. I have tried a lot of the above options, none work.

Any other ideas?

Thanks,

Kahenya

summit’s picture

Hi,
Just quick, I do not have a lot of time.
Are you aware that the

On na.nid = n.nid Where (na.grant_view.... etc..

Is added to you query through your access rules. With db_rewrite_sql statement you add this to your query.
there are lots of problems with this access rule additing and already available queries in all sorts of modules.
The best solution I saw, is that you first and for all make the n.nid field the first in the SELECT query.

Please search drupal.org on db_rewrite_sql and node access and you will find lots of forum posts about this subject.
Sometimes just not using db_rewrite_sql helps, but be aware that the query is not following access rules anymore if you need those!

greetings,
Martijn

Anonymous’s picture

Well

Quickie update. If you have Views 5.16, and nodecarousel dev or stable, this issue comes up. If I try run nodecarousel with any other option the error disappears. However, with views it appears.

Where to to look next and what to look for?

Kahenya

Anonymous’s picture

Status: Active » Closed (fixed)

Resolved

kenorb’s picture

Status: Closed (fixed) » Closed (duplicate)