Hi guys I'm stuck on a problem for my first database on Postgres and I cannot find a solution, I tried to see if it was a matter of setting autocommit on but apparently from postgres 9.x it's an inconclusive operation. The documentation suggests that it might be an error on permissions or a full disk.
This is the code
CREATE DATABASE datacamp_courses
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'English_United States.1252'
LC_CTYPE = 'English_United States.1252'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
CREATE TABLE datacamp_courses (
course_id SERIAL PRIMARY KEY,
course_name VARCHAR (50) UNIQUE NOT NULL,
course_instructor VARCHAR (100) NOT NULL,
topic VARCHAR (2) NOT NULL
);
This is the error :
ERROR: CREATE DATABASE cannot run inside a transaction block
SQL state: 25001
Any help would be greatly appreciated
Copyright Notice:Content Author:「Luca Conin」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/60528454/error-create-database-cannot-run-inside-a-transaction-block-sql-state-25001