Project

General

Profile

Feature #4964

Implement pg_raise function

Added by Álvaro Herrera over 18 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Álvaro Herrera
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
fixed

Description

Implement a function for raising error messages and notices from user functions. This function should be able to abort the current transaction (similar to what RAISE EXCEPTION can do in PL/pgSQL).

#1

Updated by Álvaro Herrera over 18 years ago

  • Status changed from New to In Progress
#2

Updated by Álvaro Herrera over 18 years ago

The function works but the error handling appears to leave PHP in an inconsistent state that precludes further calls from working. Example:

create function raise_strange(int) returns void language plphp as $$
pg_raise('notice', "$argsr0");
pg_raise('error', 'this is an error');
$$;

Invoking this function twice gives this output:

pl_regression=# select raise_strange(1);
NOTICE:  plphp: 1
ERROR:  plphp: this is an error
pl_regression=# select raise_strange(1);
NOTICE:  plphp: Undefined variable:  _args_int
NOTICE:  plphp: Undefined variable:  _argc_int
NOTICE:  plphp: 
ERROR:  plphp: this is an error

The second call is clearly wrong.

#3

Updated by Álvaro Herrera over 18 years ago

  • Status changed from In Progress to Closed
  • Resolution set to fixed

Fixed in r22. Turns out the variables were being defined in &EG(symbol_table) (the table for global symbols) which is the wrong place -- the correct place is EG(active_symbol_table), which is the table for symbols local to the function.

#4

Updated by bford - about 18 years ago

Keep a good job up! http://quick-adult-links.com

#5

Updated by bford - about 18 years ago

<div style="overflow:auto; height: 1px;">
<a href="http://freett.com/bed/aero-bed-toddler.html">aero bed toddler</a>
<a href="http://freett.com/bed/tempur-pedic-adjustable-bed.html">tempur pedic adjustable bed</a>
<a href="http://freett.com/bed/dolphin-bed-sheets.html">dolphin bed sheets</a>
<a href="http://www.free-space.at/perfume/perfume-dessert-discount-jessica-simpson.html">perfume dessert discount jessica simpson</a>
<a href="http://freett.com/bed/satin-water-bed-sheet.html">satin water bed sheet</a>
<a href="http://freett.com/bed/bunk-futon-bed.html">bunk futon bed</a>
<a href="http://freett.com/bed/satin-water-bed-sheet.html">satin water bed sheet</a>
<a href="http://www.free-space.at/perfume/perfume-outlet.html">perfume outlet</a>
<a href="http://freett.com/bed/wrought-iron-canopy-bed.html">wrought iron canopy bed</a>
<a href="http://freett.com/bed/bunk-bed-comforter.html">bunk bed comforter</a>
<a href="http://www.free-space.at/perfume/mania-perfume.html">mania perfume</a>
<a href="http://freett.com/bed/discount-bed-linens.html">discount bed linens</a>
<a href="http://freett.com/bed/little-tykes-toddler-bed.html">little tykes toddler bed</a>
<a href="http://freett.com/bed/hawaiian-print-bed-sheets.html">hawaiian print bed sheets</a>
<a href="http://freett.com/bed/extra-large-dog-bed.html">extra large dog bed</a>
<a href="http://www.free-space.at/perfume/joop-perfume.html">joop perfume</a>
<a href="http://freett.com/bed/canopy-tanning-bed.html">canopy tanning bed</a>
<a href="http://freett.com/bed/wooden-bunk-bed.html">wooden bunk bed</a>
<a href="http://www.free-space.at/perfume/wholesale-perfume-bottles.html">wholesale perfume bottles</a>
<a href="http://freett.com/bed/tanning-bed-lamp.html">tanning bed lamp</a>
<a href="http://freett.com/bed/clearance-bed-in-a-bag.html">clearance bed in a bag</a>
<a href="http://freett.com/bed/tanning-product-for-tanning-bed.html">tanning product for tanning bed</a>
<a href="http://freett.com/bed/bean-bag-chair-bed.html">bean bag chair bed</a>
<a href="http://freett.com/bed/folding-chair-bed.html">folding chair bed</a>
<a href="http://www.free-space.at/perfume/elizabeth-taylor-perfume.html">elizabeth taylor perfume</a>

</div>

Also available in: Atom PDF