Re: regclass without error? - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: regclass without error?
Date
Msg-id 1283534494-sup-8922@alvh.no-ip.org
Whole thread Raw
In response to Re: regclass without error?  (David Fetter <david@fetter.org>)
Responses Re: regclass without error?  (David Fetter <david@fetter.org>)
List pgsql-hackers
Excerpts from David Fetter's message of vie sep 03 10:21:00 -0400 2010:

> > How about using a SAVEPOINT before the cast?  Wouldn't fail your
> > transaction..
> 
> For unattended operation, there are some issues:
> 
> * Generating appropriate SAVEPOINT names
> * Keeping track of same
> * Detecting errors
> * Issuing ROLLBACKs to the aforementioned SAVEPOINT
> 
> None of this works super well for a bulk load.

Why do you need any of this?  The logic is pretty simple:

SAVEPOINT my_savepoint;
select ...::regclass;

-- if it works
RELEASE my_savepoint;

-- if it fails
ROLLBACK TO my_savepoint;
RELEASE my_savepoint;


Granted, it's not super-performant ...

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)
Next
From: David Fetter
Date:
Subject: Re: regclass without error?