On 25th Robert Haas committed patch which adds first of ‘CREATE IF NOT EXISTS' commands:
Log Message: ----------- CREATE TABLE IF NOT EXISTS. Reviewed BY Bernd Helmle.
Example is of course trivial:
$ CREATE TABLE IF NOT EXISTS tesit (x text); CREATE TABLE $ CREATE TABLE IF NOT EXISTS tesit (x text); NOTICE: relation "tesit" already EXISTS, skipping CREATE TABLE
As you can see there is no error – just a friendly notice.
Now. With some luck we'll get the same for schemata, indexes, views and other db objects, and we'll no longer need ugly workarounds.