Kaylee
Kaylee

Reputation: 3

How to select schema to create table in PostgreSQL

I created the WSI schema and in trying to create a table under that query, i keep getting the error below. I tried to set the search path to the new schema but I keep running into the same error.

ERROR: no schema has been selected to create in
SQL state: 3F000

My attempt and the output are as shown below

enter image description here

Upvotes: 0

Views: 8217

Answers (1)

Jayadevan
Jayadevan

Reputation: 1332

I suspect it is the uppercase schema name that is causing the issues.

test=# set search_path to WSI;
SET
test=# show search_path;
 search_path 
-------------
 wsi
(1 row)

test=# create table myt (id integer);
ERROR:  no schema has been selected to create in
LINE 1: create table myt (id integer);
                     ^
test=# set search_path to "WSI";
SET
test=# show search_path;
 search_path 
-------------
 "WSI"
(1 row)

test=# create table myt (id integer);
CREATE TABLE

Upvotes: 1

Related Questions