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

Re: SQLERRD and dump of variables

From: Joel Jacobson <joel(at)gluefinance(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQLERRD and dump of variables
Date: 2011-04-29 08:22:53
Message-ID: BANLkTin_REXZ4YZQ2vo9cxsan0wc1KOXzQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
2011/4/28 Noah Misch <noah(at)leadboat(dot)com>

> In the mean time, have you considered doing something like this instead?
>
> EXCEPTION WHEN deadlock_detected
>        RAISE NOTICE '% var_foo % var_bar', var_foo, var_bar;
>        RAISE;
>
> The information isn't as nicely aggregated, but you don't lose any details.
>

Thank you, very useful! This solved my problem. I wrote a comment at
http://www.postgresql.org/docs/9.0/interactive/plpgsql-errors-and-messages.html
.



> Also keep in mind that you may have several PL/pgSQL functions in your call
> stack, and you'll want to capture the local variables at each level.
>

Yes, the format of the string written to the log must support multi-level
data strucutres, perhaps JSON would be a good choice.



> Consider the potential need to avoid logging very-large variable values.
>  The
> GUC could perhaps be a size limit (0 disables the feature entirely), not a
> boolean.
>

Yes, for very large values, it's okay if they are truncated or perhaps
truncated+a simple MD5-hash of the value, so you can check if it is equal to
the excepted value. You are usually not interested in these anyway, since
what you are looking for are probably things like ID-numbers, usernames,
etc.

In response to

pgsql-hackers by date

Next:From: Vaibhav KaushalDate: 2011-04-29 09:52:07
Subject: Re: What would AggrefExprState nodes' args contain?
Previous:From: Michael MeskesDate: 2011-04-29 08:19:30
Subject: Re: unknown conversion %m

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