How to get the content owned by the currently logged-in user? A user is the owner of only one node, and I want to redirect the user, at login time, to his only owned node.

How can I get the node content if I know only the logged-in user?
This is how I have do it:

function MYHOOK_user_login(&amp;$edit, $account) {
    global $user;
    $nid = db_query('SELECT nid FROM {node} WHERE uid = :uid', array(':uid' =&gt; $user-&gt;uid))-&gt;fetchField();
    drupal_goto('node/' . $nid);
}