I am getting a SQL error after creating a view to return blogs created after a certain date. I use "Node: Created Date After" as an argument in the view.

When passing the "today-7" argument to the view, I get the following SQL error:

Unknown column 'drupal_node.created' in 'where clause' query:
SELECT node.nid, node.created AS node_created_created, node.title AS node_title,
node.changed AS node_changed, node.created AS node_created
FROM drupal_node node
WHERE (node.type IN ('blog')) AND (node.status = '1') AND (drupal_node.created > 1199998218)
ORDER BY node_created_created DESC LIMIT 0, 10

My database tables for this site are using the "drupal_" prefix. It seems like mysql cannot handle this because the "created" column uses the actual table name and not the alias designated in the FROM clause. Changing the function "daterange_node_created_argument_handler" to use "node" instead of the full table name fixed this problem.

I am using Views 5.x-1.6 and mysql 5.0.54.

(I am using the daterange filter on another site that does not have the "drupal_" table name prefix and there are no problems.)

Comments

douggreen’s picture

Can you reproduce this on a fresh install of Drupal?

I can't reproduce it. I installed a fresh 5.x Drupal with the column prefix "xxx", devel, views, and daterange. I created 50 nodes using devel generate. I created a view page with "teaser lists", "Node: Created time Between" with the operator to "after", and exposed the filter. Then I visited the view page and I didn't get any errors. I also tried with a "list view" / "table view" and a single "node created" field. But no errors...

brenk28’s picture

Was just checking the update and saw somebody else had reported the same problem and it was fixed.

http://drupal.org/node/224124

Thanks.

brenk28’s picture

Status: Active » Closed (fixed)