I am trying to publicate the cnt_title
table using PostgreSQL Logical Replication. Note that I only want to share the product titles.
create publication cnt_publication_for_stk for table
cnt_title where (doc_type = 'PRODUCT');
What I have found is a syntax error saying User-defined types are not allowed.
This is consistent with the idea of docs_type
being a column of custom type tdoc
, defined as
create type tdoc as enum (
'ARTICLE',
'PRODUCT',
'VOUCHER'
);
Is there any work around for this expression?
2
Answers
According to the docs, row filter expressions cannot contain user-defined functions, operators, types, and collations, system column references or non-immutable built-in functions.
In addition, if a publication publishes
UPDATE
orDELETE
operations, the row filterWHERE
clause must contain only columns that are covered by the replica identityYou should use a lookup table instead of an enum type. That is, use a table:
and use the primary key instead of the enum value.