Ok, as someone who's battled with this... feature... of WP I am super curious as to the very good reason for storing the domain in the DB. Why couldn't links be relative (no need to know the domain), or set
only as a sitewide variable in wp-config.php?
edit: and just discovered the 'guid' column on the posts table is hardcoded as the URL of the post -- the domain you're on at the time you create the content + the post ID. Seems like a nightmare for content staging on a non-prod environment.