Re: pl/perl not rethrowing pl/pgsql exceptions

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: pl/perl not rethrowing pl/pgsql exceptions
Date: 2010-01-05 18:48:29
Message-ID: b42b73151001051048x2136c8c2p8e7e3f62cf80019a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 5, 2010 at 12:49 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> is this behavior correct?
>
> create or replace function error() returns text as
> $$
> begin
>  raise exception 'test!';
> end;
> $$ language plpgsql;
>
>
> create or replace function test() returns text as
> $$
>  my $res = spi_query("select error()"); # this error is ignored
>  my $res = spi_query("something stupid!"); # this is not?
> $$ language plperlu;

I got the answer on IRC. spi_query only parses the statement but does
not necessarily execute it (it's more like spi_prepare).
spi_exec_query works the way I think it should.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Frank Joerdens 2010-01-05 19:36:26 Re: reason for default PGSTAT_ACTIVITY_SIZE
Previous Message Guillaume Lelarge 2010-01-05 18:24:40 Re: reason for default PGSTAT_ACTIVITY_SIZE