Extension version strings need to be quoted. Either double or single quotes will work. In released psql clients, tab completion offers double quoted suggestions:
alter extension pg_trgm update TO <tab><tab>
"1.3" "1.4" "1.5" "1.6"
But commit 02b8048ba5 broke that, it now offers unquoted version strings which if used as offered then lead to syntax errors.
The code change seems to have been intentional, but I don't think the behavior change was intended. While the version string might not be an identifier, it still needs to be treated as if it were one. Putting pg_catalog.quote_ident back into Query_for_list_of_available_extension_versions* fixes it, but might not be the best way to fix it.
commit 02b8048ba5dc36238f3e7c3c58c5946220298d71 (HEAD, refs/bisect/bad)
Author: Tom Lane <
tgl@sss.pgh.pa.us>
Date: Sun Jan 30 13:33:23 2022 -0500
psql: improve tab-complete's handling of variant SQL names.
Cheer,
Jeff