Re: Create table if not exists ... how ??

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Create table if not exists ... how ??
Date: 2010-07-20 13:27:45
Message-ID: 20100720132745.GD7584@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 20, 2010 at 10:18:59AM +0100, Jennifer Trey wrote:
> What is the most generic exception in postgres ? Throwable in Java ?

AFAIR, from programming Java many moons ago, you really don't want to go
about catching the most general exception. The ThreadDeath exception
for instance is derived from Error rather than Exception for this
reason.

That said, maybe you want the "magic" exception type OTHERS, i.e:

EXCEPTION WHEN OTHERS THEN

PG doesn't have as flexible hierarchy as Java, but a match is considered
to have occurred upto the first zero in the error code. So you could
also use syntax_error_or_access_rule_violation or transaction_rollback.

--
Sam http://samason.me.uk/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pdovera@tiscali.it 2010-07-20 13:42:23 INSERT RETURNING and partitioning
Previous Message Oluwatope Akinniyi 2010-07-20 13:10:42 I think you'll like it!