When clicking the Revisions tab of any of my custom blocks in order to restore a revision, I get:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'vid' in field list is ambiguous: SELECT vid, body, format, br.timestamp, br.log, u.uid, u.name FROM {boxes_revisions} br LEFT JOIN {users} u ON br.uid = u.uid WHERE br.bid = :bid ORDER BY timestamp DESC; Array ( [:bid] => 18 ) in block_revision_list() (line 149 of /home/mysampleuser/public_html/sites/all/modules/block_revisions/block_revisions.admin.inc).

"vid" exists in both the boxes_revisions and users tables, hence the ambiguity.
Working on a patch.

Maybe it should be:

SELECT br.vid, body, format, br.timestamp, br.log, u.uid, u.name FROM {boxes_revisions} br LEFT JOIN {users} u ON br.uid = u.uid WHERE br.bid = :bid ORDER BY timestamp DESC;

I tried this out in phpMyAdmin and it worked there...

Comments

caspervoogt’s picture

StatusFileSize
new802 bytes

Here's the patch.

dmitrit’s picture

Status: Active » Fixed

Commited.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

caspervoogt’s picture

Issue summary: View changes

I encountered a very similar error when click "Revert", but on line 52 of block_revisions.module.
Changed this:
$query = 'SELECT bid, vid, body, format, br.timestamp, br.log, u.uid, u.name FROM {boxes_revisions} br LEFT JOIN {users} u ON br.uid = u.uid WHERE br.bid = :bid AND br.vid = :vid';

to this:

$query = 'SELECT bid, br.vid, body, format, br.timestamp, br.log, u.uid, u.name FROM {boxes_revisions} br LEFT JOIN {users} u ON br.uid = u.uid WHERE br.bid = :bid AND br.vid = :vid';

That solved it for me.

caspervoogt’s picture

caspervoogt’s picture

see patch above. This solved it on my end.

caspervoogt’s picture

Status: Closed (fixed) » Needs review

dmitrit’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.