I've got a CSV file of new posts which I'll be importing straight into the database.
Is it safe to give a GUID of
[n] is any number, as long as it's not a duplicate of an existing post?
Short answer: yes
The GUID field is meant to represent a globally unique identifier for the post. In WordPress we just happen to use the URL. The GUID field should never be thought of as an actual URL, though ... just an identifier for the post.
In reality, the GUID field could contain anything that's unique. But if you have two posts that share the same GUID, you might want to consider bumping one or the other. Importing the CSV of posts into an empty blog and using the WordPress Import/Export mechanism would help. Or setting
The GUID exists as a unique identifier for feeds. Feed readers need this in order to cache feeds and not keep repeating the same content.
It's not safe to give a GUID of http://domain/?p=[n] where [n] equals any number because when new content is created (including auto saves) WordPress assigns a GUID. If your GUID's don't follow the WordPress structure you will get collisions and duplicate GUID's can really mess up your feeds.
With WordPress, the GUID is http://example.com/?p= (for posts) or ?page_id= (for pages).
This SQL is an example of how to update published posts:
By using ID you are doing the same thing WordPress does. WordPress won't ever give duplicate post_id's so its safe to use.