After some googling, I found a solution here:
<http://www.peterbe.com/plog/pg_class>
IF EXISTS (SELECT relname FROM pg_class WHERE relname='tmp_sources')
THEN
It seems to work ok.
--
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database: http://solumslekt.org/blog/