Re: Misleading error message in logical decoding for binary plugins

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Misleading error message in logical decoding for binary plugins
Date: 2014-08-29 14:07:44
Message-ID: CAB7nPqR2rdF1sLZVVW4fptPuo6UOE3=Q3GjCcQTCU8TwkeViqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 29, 2014 at 10:48 PM, Andres Freund <andres(at)2ndquadrant(dot)com>
wrote:

> On 2014-08-29 22:42:46 +0900, Michael Paquier wrote:
> > Hi all,
> >
> > Using a plugin producing binary output, I came across this error:
> > =# select data from pg_logical_slot_peek_changes('foo', NULL, NULL);
> > ERROR: 0A000: output plugin cannot produce binary output
> > LOCATION: pg_logical_slot_get_changes_guts, logicalfuncs.c:404
> >
> > Shouldn't the error message be here something like "binary output plugin
> > cannot produce textual output"? The plugin used in my case produces
> binary
> > output, but what is requested from it with pg_logical_slot_peek_changes
> is
> > textual output.
>
> I don't like the new message much. It's imo even more misleading than
> the old message. How about
> "output plugin produces binary output but the sink only accepts textual
> data"?
>
Sounds fine for me. I am sure that native English speakers will come up as
well with additional suggestions.

Btw, I am having a hard time understanding in which case
OUTPUT_PLUGIN_BINARY_OUTPUT is actually useful. Looking at the code it is
only a subset of what OUTPUT_PLUGIN_TEXTUAL_OUTPUT can do as textual can
generate both binary and textual output, while binary can only generate
binary output. The only code path where a flag OUTPUT_PLUGIN_* is used is
in this code path for this very specific error message. On top of that, a
logical receiver receives data in textual form even if the decoder is
marked as binary when getting a message with PQgetCopyData.

Perhaps I am missing something... But in this case I think that the
documentation should have a more detailed explanation about the output
format options. Currently only the option value is mentioned, and there is
nothing about what they actually do. This is error-prone for the user.
Regards,
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-08-29 14:12:34 Re: 9.5: Better memory accounting, towards memory-bounded HashAgg
Previous Message Andres Freund 2014-08-29 13:48:46 Re: Misleading error message in logical decoding for binary plugins