You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
subitems has an FK reference to items via the item_id column
electrify both tables
on the client, subscribe to subitems and include items
in postgres, insert a new row into items, populating its boolean column with either true or false
in postgres, insert a new row into subitems that references the above row from items
observe that the row from items has its boolean value encoded as a full word, "true" or "false", which results in a decoding error
This doesn't occur during the initial sync and only occurs for rows of a referenced table that are streamed to the client during regular replication (after the initial sync has finished).
Postgres schema:
CREATETABLEIF NOT EXISTS items (
id TEXTPRIMARY KEY,
value TEXTNOT NULL,
is_open BOOL
);
CREATETABLEsubitems (
id TEXTPRIMARY KEY,
item_id TEXTREFERENCES items(id),
is_open BOOL
);
ALTERTABLE items ENABLE ELECTRIC;
ALTERTABLE subitems ENABLE ELECTRIC;
I have traced the origin of the "true" value to this place in LogicalReplicationProducer module's implementation:
defp process_message(
%Message{transactional?: true, prefix: "electric.fk_chain_touch", content: content},
state
) do
received = Jason.decode!(content)
And "data" later ends up passed verbatim to the serialization function in the Serialization module to encode it as part of a SatOpLog message for the client. The problem lies in the fact that the source encoding of values in this "data" map is different from what we get when querying Postgres directly with epgsql functions or when receiving regular logical replication messages.
The setup is simple:
items
andsubitems
subitems
has an FK reference toitems
via theitem_id
columnsubitems
and includeitems
items
, populating its boolean column with eithertrue
orfalse
subitems
that references the above row fromitems
items
has its boolean value encoded as a full word,"true"
or"false"
, which results in a decoding errorThis doesn't occur during the initial sync and only occurs for rows of a referenced table that are streamed to the client during regular replication (after the initial sync has finished).
Postgres schema:
Client subscription:
Inserts in Postgres:
Client log:
The text was updated successfully, but these errors were encountered: