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:31:49 |
Message-ID: | CAB7nPqQyty1cM_25zJB03cbWE9wOAU23wF7ohK+NVnuFqHAr7A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Aug 29, 2014 at 11:15 PM, Andres Freund <andres(at)2ndquadrant(dot)com>
wrote:
> No, a textual output plugin is *NOT* allowed to produce binary
> output. That'd violate e.g. pg_logical_slot_peek_changes's return type
> because it's only declared to return text.
>
A textual output plugin can call pg_logical_slot_peek_binary_changes and
pg_logical_slot_peek_changes as well,
and a binary output plugin can only call
pg_logical_slot_peek_binary_changes, and will error out with
pg_logical_slot_peek_changes:
=# select pg_create_logical_replication_slot('foo', 'test_decoding');
pg_create_logical_replication_slot
------------------------------------
(foo,0/16C6880)
(1 row)
=# create table aa as select 1;
SELECT 1
=# select substring(encode(data, 'escape'), 1, 20),
substring(data, 1, 20)
FROM pg_logical_slot_peek_binary_changes('foo', NULL, NULL);
substring | substring
----------------------+--------------------------------------------
BEGIN 1000 | \x424547494e2031303030
table public.aa: INS | \x7461626c65207075626c69632e61613a20494e53
COMMIT 1000 | \x434f4d4d49542031303030
(3 rows)
=# select pg_logical_slot_peek_changes('foo', NULL, NULL, 'force-binary',
'true');
ERROR: 0A000: output plugin cannot produce binary output
LOCATION: pg_logical_slot_get_changes_guts, logicalfuncs.c:404
=# select substring(data, 1, 20)
from pg_logical_slot_peek_binary_changes('foo', NULL, NULL,
'force-binary', 'true');
substring
--------------------------------------------
\x424547494e2031303030
\x7461626c65207075626c69632e61613a20494e53
\x434f4d4d49542031303030
(3 rows)
Is that expected?
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-08-29 14:33:45 | Re: LIMIT for UPDATE and DELETE |
Previous Message | Andres Freund | 2014-08-29 14:15:55 | Re: Misleading error message in logical decoding for binary plugins |