diff --git a/autotest.sh b/autotest.sh
index bf98932a4afe1f8be3039331fbfd373e0aab376a..a42c6ab059e4dd479de42c72f742a6903030670a 100755
--- a/autotest.sh
+++ b/autotest.sh
@@ -38,12 +38,26 @@ cat > ./tests/autoconfig-mysql.php <<DELIM
 );
 DELIM
 
+cat > ./tests/autoconfig-pgsql.php <<DELIM
+<?php
+\$AUTOCONFIG = array (
+  'installed' => false,
+  'dbtype' => 'pgsql',
+  'dbtableprefix' => 'oc_',
+  'adminlogin' => 'admin',
+  'adminpass' => 'admin',
+  'directory' => '$BASEDIR/$DATADIR',
+  'dbuser' => 'oc_autotest',	
+  'dbname' => 'oc_autotest',	
+  'dbhost' => 'localhost',
+  'dbpass' => 'owncloud',	
+);
+DELIM
 
 function execute_tests {
 	echo "Setup environment for $1 testing ..."
 	# back to root folder
 	cd $BASEDIR
-	echo $BASEDIR
 
 	# revert changes to tests/data
 	git checkout tests/data/*
@@ -59,6 +73,9 @@ function execute_tests {
 	if [ "$1" == "mysql" ] ; then
 		mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"
 	fi
+	if [ "$1" == "pgsql" ] ; then
+		dropdb -U oc_autotest oc_autotest
+	fi
 
 	# copy autoconfig
 	cp $BASEDIR/tests/autoconfig-$1.php $BASEDIR/config/autoconfig.php
@@ -77,13 +94,17 @@ function execute_tests {
 #
 execute_tests "sqlite"
 execute_tests 'mysql'
-
-# TODO: implement this
-#execute_tests 'postgresql'
+execute_tests 'pgsql'
 
 #
-# NOTES:
+# NOTES on mysql:
 #  - CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud';
 #  - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
 #
+# NOTES on pgsql:
+#  - su - postgres
+#  - createuser -P (enter username and password and enable superuser)
+#  - to enable dropdb I decided to add following line to pg_hba.conf (this is not the safest way but I don't care for the testing machine):
+# local	all	all	trust
+#