Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 01:39 AM
Paramveer.Singh@trilogy.com
Guest
 
Posts: n/a
Default exception handling support in pgSQL

Hi!
I am a developer working for a company which typically deploys apps on
Oracle.
We would like to move to postgres for obvious reasons.
However, most of *our legacy apps use the exception handling support
provided by PL/SQL.

Instead of porting each of these procedures by hand,
we would like to add exception handling support to pgSQL if possible.

I looked into the code for the pgSQL library, and as I understand it,
we can put support for user defined exceptions (something we use a lot)
within the pgSQL library by intercepting the
pgSQL call to SPI and moving to the handler locally.

However, it seems that for system level exceptions (like zero_divide) we
would have to go into SPI where it is executing the query plan.
Is this correct? or can we put the support for these in the library itself
somehow?

If we have to make changes in SPI (or even pgSQL), would the postgres
community be interested in accepting these changes into the core?

Finally, I was trying to understand the code for the library itself, and it
seems to use a namespace stack. Is this stack used for variable scope
resolution?
Exceptions (user defined) would also require scope resolution. Therefore,
would we have to implement it within this stack ? or can we put in another
stack for the exception resolution?

thanks
paraM




---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

  #2  
Old November 23rd, 2005, 01:39 AM
Jeff
Guest
 
Posts: n/a
Default Re: exception handling support in pgSQL


On Aug 15, 2004, at 1:57 AM, Paramveer.Singh@trilogy.com wrote:[color=blue]
> Instead of porting each of these procedures by hand,
> we would like to add exception handling support to pgSQL if possible.
>[/color]

Today is your lucky day! 8.0 adds exceptions to plpgsql!
8.0 however is in beta. But testers are greatly wanted!
[color=blue]
> I looked into the code for the pgSQL library, and as I understand it,
> we can put support for user defined exceptions (something we use a lot)
> within the pgSQL library by intercepting the[/color]

I'm not sure we have user defined exceptions yet..
perhaps you could work on implementing them..

--
Jeff Trout <jeff@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles