How to apply a patch in PostgreSQL on Windows?
This answer applies to modifying the PostgreSQL source code by applying a "diff" or "patch". It's not about installing minor version updates; to do that, just download and run the installer.



To alter the PostgreSQL server its self or its procedural language runtimes, you will generally need to recompile PostgreSQL from scratch.

On Windows that's a bit of a rough job. The postgresql documentation covers the process, but it doesn't really deal with the dependencies etc.

I've written some tools and documentation to make it easier, but they don't yet compile all the dependencies like OpenSSL, so the resulting binaries aren't as feature-complete as the stock installer. They're also not guaranteed to be binary-compatible with extensions.

If you just need to patch an extension that's a little bit easier, though far from trivial. I spent some time a while ago figuring out how to build PostgreSQL extensions on Windows without recompiling all of PostgreSQL. A similar approach might work for recompiling things like pg_dump and pg_restore but I have not tested this.

Add-ons, clients and utilities like PostGIS, PgRouting, PgAdmin-III, psqlODBC, pgJDBC, psycopg2, the Ruby Pg gem, DBD::Pg, PgPool, etc etc etc are all compiled separately using different procedures. You'll want to look up the tool in question for details.

Frankly, if you're doing any kind of development work on PostgreSQL, I don't recommend Windows as a platform.