model-writtenrun 7230 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- The thread began with Jeff Davis announcing 05e1737351, which forced a safe search_path during maintenance to prevent MAINTAIN grantees from escalating to table owners and required affected functions to declare their own search_path #1.
- Buildfarm failures exposed that amcheck functions could reach SetConfigOption() during parallel execution, so Jeff posted a PARALLEL UNSAFE extension upgrade, then acknowledged that it could regress users who checked multiple indexes through parallel queries #2 #3 #4.
- Tom Lane requested a revert because the compatibility change arrived too late in the PostgreSQL 16 release cycle, and Jeff reverted the broad fix in 2fcc7ee7af; the attached amcheck remedy appears in neither candidate commit #5 #18.
- Robert Haas questioned why the safe path included pg_temp, and Jeff explained that explicitly placing it after pg_catalog avoids the implicit temporary-schema-first lookup while maintenance runs as the table owner #7 #8.
- Noah Misch favored the broad fix because many affected expressions already failed under autovacuum's restricted path, while Tom maintained that changing semantics after beta testing was unacceptable; Jeff moved the proposal to the PostgreSQL 17 commitfest #13 #18 #22.
- David G. Johnston proposed restricting search_path only for callers without ownership rights, and Robert refined the ownership test to has_privs_of_role() #10 #23.
- A related discussion concluded that granting MAINTAIN entails trusting the grantee to choose maintenance settings, including statistics targets, rather than limiting ANALYZE to defaults #19 #20 #21.
- Robert insisted that PostgreSQL should fix or remove MAINTAIN rather than ship its known privilege-escalation hazard, prompting Jeff to attach the narrower owner-exempt implementation #25 #28.
- Tom rejected the narrower implementation because owners and MAINTAIN grantees would see different behavior and its security coverage remained questionable, after which Nathan Bossart posted a separate patch removing MAINTAIN and pg_maintain #29 #30.
- Jeff demonstrated that caller-controlled search_path could already undermine an expression index's uniqueness behavior, arguing that maintenance was only one part of a broader need to stabilize function execution environments #31.
- Noah proposed retaining a smaller MAINTAIN feature for VACUUM, ANALYZE and REINDEX while postponing CLUSTER and REFRESH, but Nathan doubted that another late-cycle compromise would be accepted; they also considered reverting only the stable branch and restoring the broad fix on development #33 #34 #35.
- Jeff reviewed Nathan's revert by independently reconstructing it, questioned a vacuum ownership check and requested a catalog-version bump; Nathan explained that the check had previously moved and retained its placement #36 #37.
- Nathan's revised revert removed an additional obsolete pg_upgrade normalization rule after cross-version testing, while still leaving the catalog-version bump for commit time #38.
- Jeff recommended reverting both branches because the search_path fix's landing date was uncertain, and Nathan committed the revised revert as 151c22deee with the catalog-version bump and corresponding stable backport #39 #40 #41.
- The later discussion broadened to systemic security: Robert proposed capturing search_path when functions are defined and controlling execution of untrusted code, while Joe Conway warned that overload resolution can redirect calls even when the path itself stays fixed #42 #43 #44.
- Jeff identified further complications involving schema permissions, changing schema contents and $user, while Robert compared definition-time parsing with capturing search_path and explained the compatibility, DDL and dependency obstacles to earlier parsing #46 #47 #49.
- David advocated safe default function paths with explicit escape mechanisms, and the final exchange tentatively favored capturing search_path by default while allowing explicit session-dependent behavior; at the thread's end, MAINTAIN had been reverted and these broader function semantics remained unresolved #50 #52 #53 #54.
- The broad maintenance restriction eventually landed in March 2024 as 2af07e2f74, but the supplied cross-thread evidence identifies the later matching patchset #555068 in thread #49196 as its source, with light documentation and test additions, superseding the previous attribution to this thread's discussion.