Just as an FYI since you were working in this area, Tom has just knocked off one of the blockers for tab completion on Windows, namely that MSVC didn't like the overgrown if-then-else code in tab-complete.c[1]. That is now fixed in PostgreSQL's master branch[2][3][4] (v18 to be).