port mysql_example to PostgreSQL