Fix custom validators call in build_local_reloptions()
authorAlexander Korotkov
Sun, 23 Apr 2023 10:55:49 +0000 (13:55 +0300)
committerAlexander Korotkov
Sun, 23 Apr 2023 11:00:13 +0000 (14:00 +0300)
We need to call them only when validate == true.

Backpatch to 13, where opclass options were introduced.

Reported-by: Tom Lane
Discussion: https://postgr.es/m/2656633.1681831542%40sss.pgh.pa.us
Reviewed-by: Tom Lane, Pavel Borisov
Backpatch-through: 13

src/backend/access/common/reloptions.c

index b5602f53233302280910c7a76171874d2e468b97..39e0cd1fca68921bb78fa4e46f0c410c871011c8 100644 (file)
@@ -1963,8 +1963,9 @@ build_local_reloptions(local_relopts *relopts, Datum options, bool validate)
    fillRelOptions(opts, relopts->relopt_struct_size, vals, noptions, validate,
                   elems, noptions);
 
-   foreach(lc, relopts->validators)
-       ((relopts_validator) lfirst(lc)) (opts, vals, noptions);
+   if (validate)
+       foreach(lc, relopts->validators)
+           ((relopts_validator) lfirst(lc)) (opts, vals, noptions);
 
    if (elems)
        pfree(elems);