On Tue, 2021-07-13 at 10:24 +0530, Amit Kapila wrote: > to do. AFAIU, the main things we want to prohibit in the filter are: > (a) it doesn't refer to any relation other than catalog in where > clause,
Right, because the walsender is using a historical snapshot. > (b) it doesn't use UDFs in any way (in expressions, in > user-defined operators, user-defined types, etc.), Is this a reasonable requirement? Postgres has a long history of allowing UDFs nearly everywhere that a built-in is allowed. It feels wrong to make built-ins special for this feature. > (c) the columns > referred to in the filter should be part of PK or Replica Identity. Why? Also: * Andres also mentioned that the function should not leak memory. * One use case for this feature is when sharding a table, so the expression should allow things like "hashint8(x) between ...". I'd really like to see this problem solved, as well. > I think in the long run one idea to allow UDFs is probably by > explicitly allowing users to specify whether the function is > publication predicate safe and if so, then we can allow such > functions > in the filter clause. This sounds like a better direction. We probably need some kind of catalog information here to say what functions/operators are "safe" for this kind of purpose. There are a couple questions: 1. Should this notion of safety be specific to this feature, or should we try to generalize it so that other areas of the system might benefit as well? 2. Should this marking be superuser-only, or user-specified? 3. Should it be related to the IMMUTABLE/STABLE/VOLATILE designation, or completely separate? Regards, Jeff Davis