From 680b99fcbaed120d4253a4bed397c81c22c58209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Mon, 10 Dec 2007 10:52:52 +0000 Subject: #198187 by mcarbone: resolve conflicts of n.uid and r.uid, so the node author uid takes precedence over the revision uid --- modules/node/node.module | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modules/node/node.module') diff --git a/modules/node/node.module b/modules/node/node.module index fae77fe64..0722b9be5 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -688,9 +688,15 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) { $fields = drupal_schema_fields_sql('node', 'n'); $fields = array_merge($fields, drupal_schema_fields_sql('node_revisions', 'r')); $fields = array_merge($fields, array('u.name', 'u.picture', 'u.data')); + // Remove fields not needed in the query: n.vid and r.nid are redundant, + // n.title is unnecessary because the node title comes from the + // node_revisions table. We'll keep r.vid, r.title, and n.nid. + $fields = array_diff($fields, array('n.vid', 'n.title', 'r.nid')); $fields = implode(', ', $fields); - // rename timestamp field for clarity. + // Rename timestamp field for clarity. $fields = str_replace('r.timestamp', 'r.timestamp AS revision_timestamp', $fields); + // Change name of revision uid so it doesn't conflict with n.uid. + $fields = str_replace('r.uid', 'r.uid AS revision_uid', $fields); // Retrieve the node. // No db_rewrite_sql is applied so as to get complete indexing for search. -- cgit v1.2.3