From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: COPYable logs |
Date: | 2007-08-06 17:59:43 |
Message-ID: | 46B7618F.2050102@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> I'm looking at doing #1, but I'm not sure where I can sensibly check
>> that redirection is on if cvslog destination is specified. I could check
>> when elog() is called, but that seems wasteful. Any ideas?
>>
>
> It's only one extra bool test in elog(), isn't it?
>
> if ((Log_destination & LOG_DESTINATION_CSV) && Redirect_stderr)
>
> Hardly seems worth major contortions to avoid, considering the number of
> cycles an elog() call expends anyway.
>
> I thought about adding an assign-hook for Log_destination that forbids
> setting the CSV bit unless Redirect_stderr is set, but the trouble with
> that is that it's making unsupportable assumptions about the order in
> which the GUC variables will be set.
>
>
>
agreed. Creating infrastructure for checking internal consistency of GUC
vars would be a major pain.
After sleeping on it I came to pretty much the conclusion you did,
although I'm testing for redirection_done rather than the GUC setting
directly. My current skeleton looks like this:
if (Log_destination & LOG_DESTINATION_STDERR)
{
if (redirection_done)
{
/* send CSV data down the pipe if it's safe to do so */
write_csvlog(edata);
}
else
{
char * msg = _("Not safe to send CSV data\n");
write(fileno(stderr),msg,strlen(msg));
write(fileno(stderr), buf.data, buf.len);
}
}
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2007-08-06 19:55:14 | Re: .NET driver |
Previous Message | Tom Lane | 2007-08-06 17:42:07 | Re: COPYable logs |
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2007-08-06 21:21:08 | Memory leak in nodeAgg |
Previous Message | Tom Lane | 2007-08-06 17:42:07 | Re: COPYable logs |