Re: usar raise notice con sqlstate

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "Miguel Beltran R(dot)" <yourpadre(at)gmail(dot)com>
Cc: Ayuda Postgres <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: usar raise notice con sqlstate
Date: 2008-03-12 16:19:17
Message-ID: 20080312161917.GD8328@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Miguel Beltran R. escribió:

> Tengo
> BEGIN
> ....
> EXCEPTION WHEN OTHERS THEN
> RAISE NOTICE SQLSTATE || ' ' SQLERRM;
> END

alvherre=# create function muestra_error() returns void language plpgsql as $$ begin select foo; exception when others then raise notice '% %', sqlstate, sqlerrm; end; $$;
CREATE FUNCTION

alvherre=# select muestra_error();
INFO: 42703 la colonne « foo » n'existe pas
muestra_error
---------------

(1 ligne)

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message MIGUEL CANCHAS 2008-03-12 16:25:38 Error con el COPY ???????????
Previous Message jlcambero 2008-03-12 16:02:23 Re: usar raise notice con sqlstate