I am working on AWS server + PostgreSQL. When I execute a query for creating the database I get an error:
CREATE DATABASE cannot run inside a transaction blo
Note, for postgres 9.5+ you have to use:
psql -c '\set AUTOCOMMIT on'
But I'm going to guess, that what you really wanted to do is destroy the database and recreate it in a single command. Here you go:
printf '\set AUTOCOMMIT on\ndrop database ; create database ; ' | psql postgres