Step1: Download the patch from
Note: Applying the patch requires that you have the source tree downloaded
and can build from there. If you've installed from a package, then
you'll need to run the pg_config command that comes with your package.
It's often part of the -dev or -devel package. That command will
tell you all the switches used to build your package.
It's often much better to test this patch on a non-production machine,
so go to another machine and get the latest PostgreSQL package that
matches your major version. I.e. if you're running 8.3.5 in
production you'll want to download 8.3.15.
Step2: Untar it and then cd into the src directory and apply the patch:
patch -p0 < patchfile
see if it applies. If it complains about
the file not being in the right dir or other we'll
go another way to patch.
Step3: After that, in the main postgresql directory run configure
sudo make install
Step4: Patching Completes