Re: Collation versioning
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Michael Paquier <michael@paquier.xyz>, Robert Haas <robertmhaas@gmail.com>, Laurenz Albe <laurenz.albe@cybertec.at>, Douglas Doole <dougdoole@gmail.com>, Christoph Berg <myon@debian.org>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2020-10-25T02:35:23Z
Lists: pgsql-hackers
Attachments
- v32-0001-Remove-pg_collation.collversion.patch (text/x-patch) patch v32-0001
- v32-0002-Add-pg_depend.refobjversion.patch (text/x-patch) patch v32-0002
- v32-0003-Track-collation-versions-for-indexes.patch (text/x-patch) patch v32-0003
On Fri, Oct 23, 2020 at 2:07 AM Julien Rouhaud <rjuju123@gmail.com> wrote: > While reviewing the changes, I found a couple of minor issues > (inherited from the previous versions). It's missing a > free_objects_addresses in recordDependencyOnCollations, and there's a > small typo. Inline diff: Thanks, fixed. I spent the past few days trying to simplify this patch further. Here's what I came up with: 1. Drop the function dependencyExists() and related code, which in earlier versions tried to avoid creating duplicate pg_depends rows by merging with existing rows. This was rather complicated, and there are not many duplicates anyway, and it's easier to suppress duplicate warnings at warning time (see do_collation_version_check()). (I'm not against working harder to make pg_depend rows unique, but it's not required for this and I didn't like that way of doing it.) 2. Use index_update_collation_versions() as the workhorse for REINDEX, binary_upgrade_set_index_coll_version() and ALTER INDEX ... ALTER COLLATION ... REFRESH_VERSION, instead of having multiple functions doing similar things. (I wondered about changing the REINDEX case to simply blow away all dependencies and re-do the analysis from scratch, which might be useful for future applications of refobjversion where the set of depended-on objects might change, but that's out of scope for now and could be added easily enough.) 3. Likewise, drop the function getDependencyVersion() and the modifications to changeDependenciesOf(); that was yet more catalog manipulation stuff, but I couldn't see why we don't just call index_update_collation_versions(newIndexId) after the CREATE INDEX CONCURRENTLY switcheroo step (see index_concurrently_swap()). 4. Drop track_version from find_expr_references_context, and also drop the pre-existing code that skipped default collations. I think it's easier to just let find_expr_references() collect everything, and leave it to later code to worry about whether to suppress "system pinned" stuff. It reduces the amount of code that has to know about refobjversion. 5. General code tidying, pgindent, wordsmithing etc. I'm not sure what I think about recordMultipleDependencies() being the function that knows how to fetch the version but I'm not sure if it's worth the refactoring effort to make ObjectAddresses (essentially a stretchy vector type) able to carry versions so we can pass that stuff in.
Commits
-
Doc: Document known problem with Windows collation versions.
- 1bf946bd43e5 14.0 landed
-
Add collation versions for FreeBSD.
- ca051d8b101d 14.0 landed
-
Tolerate version lookup failure for old style Windows locale names.
- 9f12a3b95dd5 14.0 landed
-
Track collation versions for indexes.
- 257836a75585 14.0 landed
-
Add pg_depend.refobjversion.
- cd6f479e79f3 14.0 landed
-
Remove pg_collation.collversion.
- 7d1297df0830 14.0 landed
-
Fix the MSVC build for versions 2015 and later.
- a169155453e3 13.0 cited
-
Add collation versions for Windows.
- 352f6f2df60f 13.0 cited
-
Implement type regcollation
- a2b1faa0f279 13.0 landed
-
Use libc version as a collation version on glibc systems.
- d5ac14f9ccdd 13.0 landed
- 9f90b1d08d79 13.0 landed
-
Make type "name" collation-aware.
- 586b98fdf1aa 12.0 cited