plpgsql.print_strict_params - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject plpgsql.print_strict_params
Date
Msg-id 52338A29.4010506@joh.to
Whole thread Raw
Responses Re: plpgsql.print_strict_params
Re: plpgsql.print_strict_params
List pgsql-hackers
Hi,

Attached is a patch for optionally printing more information on STRICT
failures in PL/PgSQL:


set plpgsql.print_strict_params to true;

create or replace function footest() returns void as $$
declare
x record;
p1 int := 2;
p3 text := 'foo';
begin
   -- too many rows
   select * from foo where f1 > p1 or f1::text = p3  into strict x;
   raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2;
end$$ language plpgsql;
select footest();
ERROR:  query returned more than one row
DETAIL:  p1 = '2', p3 = 'foo'
CONTEXT:  PL/pgSQL function footest() line 8 at SQL statement


This parameter is turned off by default to preserve old behaviour, but
can be extremely useful when debugging code in test environments.

I will add this to the open commitfest, but in the meanwhile, any
feedback is appreciated.


Regards,
Marko Tiikkaja

Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE
Next
From: Andres Freund
Date:
Subject: Re: proposal: Set effective_cache_size to greater of .conf value, shared_buffers