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.