From: | Marko Tiikkaja <marko(at)joh(dot)to> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | plpgsql.print_strict_params |
Date: | 2013-09-13 21:56:57 |
Message-ID: | 52338A29.4010506@joh.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
print_strict_params.patch | text/plain | 13.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2013-09-13 21:57:30 | Re: proposal: Set effective_cache_size to greater of .conf value, shared_buffers |
Previous Message | Peter Geoghegan | 2013-09-13 21:41:46 | Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE |