====== Drupal Queries ======
See also: [[database:Postgresql]]
Original Date Written: 2008/08/15 20:43
Description: Some Drupal Queries
===== View node information =====
SELECT nid, title, to_timestamp(created) as "created", to_timestamp(changed) as changed
FROM node
ORDER BY nid
}}}
===== Fixing Drupal with PGAdmin =====
Submitted by TimBruce on Tue, 07/10/2012 - 23:11
You need to update two different tables to fix the problem with unable to edit a page. Both the node and node_revisions tables need to be updated.
SELECT
n.nid, n.type, n.language, n.uid, n.status, n.created, n.changed, n.comment,
n.promote, n.moderate, n.sticky, n.tnid, n.translate, r.vid, r.uid AS revision_uid,
r.title, r.body, r.teaser, r.log, r.timestamp AS revision_timestamp, r.format,
u.name, u.picture, u.data
FROM node n
INNER JOIN users u ON u.uid = n.uid
INNER JOIN node_revisions r ON r.vid = n.vid
WHERE n.nid = 145