You could look at some pre-written nagios checks for pgsql.
That plugin is packed with features and should work for you.
Besides that you can either try to put together a very simple bash script, you could go as simple as to write your grep output to a tmp file and then regex it for any error patterns you want to see but the best option is to write something a little more robust in something like perl or python.
You can even use exit codes in your grep's, its not pretty and by far is not the best way to do it but its quick and simple. Put all of your error patterns you want to search for in a text file, one patter per line.
grep -i -A2 -B2 error /var/log/pgsql/* > $TMPFILE
egrep -i -q -f $ERRORPATTERNS $TMPFILE >> $LOGFILE
if [ $? -eq 0 ]
rm -f $TMPFILE
elif [ $? -ne 0 ]
rm -f $TMPFILE
Then you can just have nagios just run that bash script. Nagios recoginizes exit code 2 as critical, 1 as a warning, and 0 as OK. So basically if your egrep does not match anything that process will exit with status code 1, that means you have no errors that you care about so we exit the bash script with exit code 0 telling nagios everything is ok. On the other side, if egrep matches anything it will exit with status code 0 and then we can have your script exit with status code 2 which tells nagios there is a problem.
Keep in mind, this above script is extremely dirty and I just threw it up there super fast to give you some context. There is no sanitization of the input nor any sort of confirmation besides exit codes which are not the most reliable way to test for things although they do have their use.