=== Applying patches on top of PostgreSQL commit ID 5142f0093e648d1a32fdcc7c835d17fa103e1239 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Mon Apr 20 03:28:21 UTC 2026 On branch cf/5714 nothing to commit, working tree clean === using 'git am' to apply patch ./v12-0001-Add-support-for-extended-statistics-on-virtual-g.patch === Applying: Add support for extended statistics on virtual generated columns. Using index info to reconstruct a base tree... M doc/src/sgml/ref/alter_table.sgml M doc/src/sgml/ref/create_statistics.sgml M src/backend/commands/statscmds.c M src/backend/optimizer/util/plancat.c M src/backend/statistics/extended_stats.c M src/test/regress/expected/stats_ext.out M src/test/regress/sql/stats_ext.sql Falling back to patching base and 3-way merge... Auto-merging src/test/regress/sql/stats_ext.sql CONFLICT (content): Merge conflict in src/test/regress/sql/stats_ext.sql Auto-merging src/test/regress/expected/stats_ext.out CONFLICT (content): Merge conflict in src/test/regress/expected/stats_ext.out Auto-merging src/backend/statistics/extended_stats.c Auto-merging src/backend/optimizer/util/plancat.c Auto-merging src/backend/commands/statscmds.c CONFLICT (content): Merge conflict in src/backend/commands/statscmds.c Auto-merging doc/src/sgml/ref/create_statistics.sgml CONFLICT (content): Merge conflict in doc/src/sgml/ref/create_statistics.sgml error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Add support for extended statistics on virtual generated columns. When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v12-0001-Add-support-for-extended-statistics-on-virtual-g.patch === patching file doc/src/sgml/ref/alter_table.sgml Hunk #1 FAILED at 217. Hunk #2 FAILED at 289. Hunk #3 succeeded at 370 with fuzz 2 (offset 2 lines). 2 out of 3 hunks FAILED -- saving rejects to file doc/src/sgml/ref/alter_table.sgml.rej patching file doc/src/sgml/ref/create_statistics.sgml Hunk #1 FAILED at 22. Hunk #2 FAILED at 45. Hunk #3 FAILED at 53. Hunk #4 FAILED at 109. Hunk #5 FAILED at 121. Hunk #6 FAILED at 136. Hunk #7 FAILED at 169. 7 out of 7 hunks FAILED -- saving rejects to file doc/src/sgml/ref/create_statistics.sgml.rej patching file src/backend/commands/statscmds.c Hunk #1 FAILED at 28. Hunk #2 FAILED at 232. Hunk #3 FAILED at 268. Hunk #4 FAILED at 297. Hunk #5 FAILED at 336. 5 out of 5 hunks FAILED -- saving rejects to file src/backend/commands/statscmds.c.rej patching file src/backend/optimizer/util/plancat.c Hunk #1 succeeded at 1795 with fuzz 2 (offset 3 lines). patching file src/backend/statistics/extended_stats.c Hunk #1 FAILED at 32. Hunk #2 FAILED at 73. Hunk #3 FAILED at 125. Hunk #4 FAILED at 279. Hunk #5 FAILED at 416. Hunk #6 succeeded at 530 with fuzz 2 (offset 39 lines). 5 out of 6 hunks FAILED -- saving rejects to file src/backend/statistics/extended_stats.c.rej patching file src/test/regress/expected/stats_ext.out Hunk #1 FAILED at 25. Hunk #2 FAILED at 84. Hunk #3 FAILED at 3153. 3 out of 3 hunks FAILED -- saving rejects to file src/test/regress/expected/stats_ext.out.rej patching file src/test/regress/sql/stats_ext.sql Hunk #1 FAILED at 28. Hunk #2 FAILED at 56. Hunk #3 succeeded at 1608 with fuzz 2 (offset 24 lines). 2 out of 3 hunks FAILED -- saving rejects to file src/test/regress/sql/stats_ext.sql.rej Unstaged changes after reset: M doc/src/sgml/ref/alter_table.sgml M src/backend/optimizer/util/plancat.c M src/backend/statistics/extended_stats.c M src/test/regress/sql/stats_ext.sql Removing doc/src/sgml/ref/alter_table.sgml.rej Removing doc/src/sgml/ref/create_statistics.sgml.rej Removing src/backend/commands/statscmds.c.rej Removing src/backend/statistics/extended_stats.c.rej Removing src/test/regress/expected/stats_ext.out.rej Removing src/test/regress/sql/stats_ext.sql.rej === using 'git apply' to apply patch ./v12-0001-Add-support-for-extended-statistics-on-virtual-g.patch === Applied patch to 'doc/src/sgml/ref/alter_table.sgml' cleanly. Applied patch to 'doc/src/sgml/ref/create_statistics.sgml' with conflicts. Applied patch to 'src/backend/commands/statscmds.c' with conflicts. Applied patch to 'src/backend/optimizer/util/plancat.c' cleanly. Applied patch to 'src/backend/statistics/extended_stats.c' cleanly. Applied patch to 'src/test/regress/expected/stats_ext.out' with conflicts. Applied patch to 'src/test/regress/sql/stats_ext.sql' with conflicts. U doc/src/sgml/ref/create_statistics.sgml U src/backend/commands/statscmds.c U src/test/regress/expected/stats_ext.out U src/test/regress/sql/stats_ext.sql diff --cc doc/src/sgml/ref/create_statistics.sgml index 5cc1d51b4b3,678efe1eb43..00000000000 --- a/doc/src/sgml/ref/create_statistics.sgml +++ b/doc/src/sgml/ref/create_statistics.sgml @@@ -124,15 -124,15 +124,27 @@@ CREATE STATISTICS [ [ IF NOT EXISTS ] < The name of a table column to be covered by the computed statistics. This may be used to build univariate statistics on a single virtual ++<<<<<<< ours + generated column, or as part of a list of multiple columns (virtual or + non-virtual) and/or expressions to build multivariate statistics. In + the latter case, separate univariate statistics are built automatically + for each expression and virtual generated column in the list. + + + Defining extended statistics on a single non-virtual + column is not supported or necessary, because statistics are built + automatically on such columns without defining extended statistics. ++======= + generated column, or as part of a list of multiple columns (stored or + virtual) and/or expressions to build multivariate statistics. In the + latter case, separate univariate statistics are built automatically for + each expression and virtual generated column in the list. + + + Defining extended statistics on a single stored + column is not supported or necessary, because statistics are built + automatically on such columns. ++>>>>>>> theirs diff --cc src/backend/commands/statscmds.c index b354723be44,765395b4b6a..00000000000 --- a/src/backend/commands/statscmds.c +++ b/src/backend/commands/statscmds.c @@@ -274,16 -274,14 +274,25 @@@ CreateStatistics(CreateStatsStmt *stmt * Disallow data types without a less-than operator in * multivariate statistics. */ ++<<<<<<< ours + if (numcols > 1) ++======= + if (list_length(stmt->exprs) > 1) ++>>>>>>> theirs { type = lookup_type_cache(attForm->atttypid, TYPECACHE_LT_OPR); if (type->lt_opr == InvalidOid) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), ++<<<<<<< ours + errmsg("cannot create multivariate statistics on column \"%s\"", + attname), + errdetail("The type %s has no default btree operator class.", + format_type_be(attForm->atttypid)))); ++======= + errmsg("column \"%s\" cannot be used in multivariate statistics because its type %s has no default btree operator class", + attname, format_type_be(attForm->atttypid)))); ++>>>>>>> theirs } /* Treat virtual generated columns as expressions */ @@@ -321,16 -319,14 +330,25 @@@ * Disallow data types without a less-than operator in * multivariate statistics. */ ++<<<<<<< ours + if (numcols > 1) ++======= + if (list_length(stmt->exprs) > 1) ++>>>>>>> theirs { type = lookup_type_cache(var->vartype, TYPECACHE_LT_OPR); if (type->lt_opr == InvalidOid) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), ++<<<<<<< ours + errmsg("cannot create multivariate statistics on column \"%s\"", + get_attname(relid, var->varattno, false)), + errdetail("The type %s has no default btree operator class.", + format_type_be(var->vartype)))); ++======= + errmsg("column \"%s\" cannot be used in multivariate statistics because its type %s has no default btree operator class", + get_attname(relid, var->varattno, false), format_type_be(var->vartype)))); ++>>>>>>> theirs } /* Treat virtual generated columns as expressions */ diff --cc src/test/regress/expected/stats_ext.out index 37070c1a896,8b0f96a2d2e..00000000000 --- a/src/test/regress/expected/stats_ext.out +++ b/src/test/regress/expected/stats_ext.out @@@ -94,13 -93,9 +94,19 @@@ CREATE STATISTICS tst on (tableoid::int ERROR: statistics creation on system columns is not supported CREATE STATISTICS tst (ndistinct) ON xmin from ext_stats_test; ERROR: statistics creation on system columns is not supported ++<<<<<<< ours +-- statistics kinds are not allowed with univariate statistics +CREATE STATISTICS tst (ndistinct) ON (y + z) FROM ext_stats_test; +ERROR: cannot specify statistics kinds when building univariate statistics +-- multivariate statistics without a less-than operator not supported +CREATE STATISTICS tst (ndistinct) ON x, w from ext_stats_test; +ERROR: cannot create multivariate statistics on column "w" +DETAIL: The type xid has no default btree operator class. ++======= + -- multivariate statistics without a less-than operator not supported + CREATE STATISTICS tst (ndistinct) ON x, w from ext_stats_test; + ERROR: column "w" cannot be used in multivariate statistics because its type xid has no default btree operator class ++>>>>>>> theirs DROP TABLE ext_stats_test; -- Ensure stats are dropped sanely, and test IF NOT EXISTS while at it CREATE TABLE ab1 (a INTEGER, b INTEGER, c INTEGER); diff --cc src/test/regress/sql/stats_ext.sql index 3cc6012b822,72602e1e995..00000000000 --- a/src/test/regress/sql/stats_ext.sql +++ b/src/test/regress/sql/stats_ext.sql @@@ -61,8 -61,6 +61,11 @@@ CREATE STATISTICS tst on tableoid from CREATE STATISTICS tst on (tableoid) from ext_stats_test; CREATE STATISTICS tst on (tableoid::int+1) from ext_stats_test; CREATE STATISTICS tst (ndistinct) ON xmin from ext_stats_test; ++<<<<<<< ours +-- statistics kinds are not allowed with univariate statistics +CREATE STATISTICS tst (ndistinct) ON (y + z) FROM ext_stats_test; ++======= ++>>>>>>> theirs -- multivariate statistics without a less-than operator not supported CREATE STATISTICS tst (ndistinct) ON x, w from ext_stats_test; DROP TABLE ext_stats_test;