July 28th, 2010 by depesz | Tags: , , , , , , | 1 comment »
Did it help? If yes - maybe you can help me?

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.

  1. One comment

  2. # Anonymous
    Mar 12, 2011

    Thank you Mr Haas!

    one down a few more to go.

Sorry, comments for this post are disabled.