PostgreSQL is a relational database engine. You might have heard of MySQL? It does a similar sort of job.
Apple, for reasons unscrutable and strange, decided that they wanted to bundle PostgreSQL in some Mac OS X versions as a pre-installed application. Consequently it comes with some versions of Mac OS X.
Additionally, some 3rd party software will bundle PostgreSQL because it uses it to store and manage its data. It won't always be obvious what the program is.
PostgreSQL generally uses little CPU, RAM or disk I/O unless it's actually being used for serious work, so it's fairly safe to ignore it. If you're really determined to get rid of it (say, you think it might be stopping your non-SSD-based mac from spinning down its hard drive) then stop it and leave it installed but not running. If nothing breaks, disable it in launchd, but do not uninstall it. That way it has no effect but is easily restored if you discover there was a problem after all.
(Note that PostgreSQL databases aren't compatible across versions. If you delete an installed copy of 8.2 then decide you wanted that data after all, you would have to install a compatible build of 8.2 to read the data; installing the latest 9.3 release, or even 8.4, would not work).