Skip site navigation (1) Skip section navigation (2)

Re: Implementation of SQLSTATE and SQLERRM variables

From: "Dinesh Pandey" <dpandey(at)secf(dot)com>
To: "'Pavel Stehule'" <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>,"'Neil Conway'" <neilc(at)samurai(dot)com>
Cc: "'Bruce Momjian'" <pgman(at)candle(dot)pha(dot)pa(dot)us>,<pgsql-patches(at)postgresql(dot)org>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Implementation of SQLSTATE and SQLERRM variables
Date: 2005-05-26 10:21:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Is this implementation is available in postgres 8.0.2 ? Or which version of

Dinesh Pandey

-----Original Message-----
From: pgsql-patches-owner(at)postgresql(dot)org
[mailto:pgsql-patches-owner(at)postgresql(dot)org] On Behalf Of Pavel Stehule
Sent: Thursday, May 26, 2005 12:47 PM
To: Neil Conway
Cc: Bruce Momjian; pgsql-patches(at)postgresql(dot)org; 'Tom Lane'
Subject: Re: [PATCHES] Implementation of SQLSTATE and SQLERRM variables

> I think the docs need more than just "these variables are set when an 
> exception is raised".
> The patch current resets SQLSTATE and SQLERRM whenever a new block is 
> entered. So:
> create function trap_exceptions() returns void as $_$ begin
>     begin
>       raise exception 'first exception';
>     exception when others then
>       raise notice '% %', SQLSTATE, SQLERRM;
>       begin
>         raise notice '% %', SQLSTATE, SQLERRM;
>       end;
>     end;
>     return;
> end; $_$ language plpgsql;
> The second RAISE will report "successful completion". Is this the 
> behavior we want?

True, its foggy behave. Only if block contains exception than variables
SQLSTATE and SQLERRM are created. 

> Is SQLERRM the best name for that variable? It seems a little obscure to

This name use Oracle in PL/SQL. ESQL Oracle and DB2 too. I think so is
better use well knowed names for it than creating own. There is one argument
for it. PL/pgSQL is language very similar Oracle PL/SQL. PL/SQL know
SQLERRM, SQLCODE and SQLSTATE. An people which know PL/SQL will like use
this names in Pg.

Pavel Stehule

> -Neil
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

In response to


pgsql-patches by date

Next:From: Peter EisentrautDate: 2005-05-26 10:59:51
Subject: Re: Implementation of SQLSTATE and SQLERRM variables
Previous:From: ITAGAKI TakahiroDate: 2005-05-26 08:04:01
Subject: O_DIRECT for WAL writes

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group