How to get The Loop working with $wpdb->get_results()

Turns out I didn’t follow the instructions in the manual to the letter: I seem to have declared global $post too early. I don’t entirely see through this but it works fine now using this code:

$eventsPosts = $wpdb->get_results($querystr, OBJECT);

if ($eventsPosts)
 {
   global $post;
   foreach ($eventsPosts as $post) 
    { 
     setup_postdata($post);
     the_title(); // or whatever - the loop functions work
    }  
 }