0

I am trying to import an SQL file as part of the database through PGAdmin3 but I am getting error as the schema not found. But when I try to select the namespace it list that schema.
Below is the output from the DB

test=# select nspname from pg_catalog.pg_namespace;
      nspname
--------------------
 pg_catalog
 pg_toast
 public
 pg_temp_1
 pg_toast_temp_1
 information_schema
 testschema
(7 rows)

Below is the sql commands which I am trying to run from script

CREATE TABLE TestSchema.Emp (
                lastname VARCHAR(50) NOT NULL,
                firstname VARCHAR(10) NOT NULL,
                empid INTEGER PRIMARY KEY
};

ERROR:  schema "testschema" does not exist
********** Error **********

ERROR: schema "testschema" does not exist
SQL state: 3F000

Any thoughts why this error is coming.

2
  • Are you sure you're looking at the same database both times? Commented Feb 24, 2014 at 9:28
  • When the pgadmin3 launch it ask me database which I provide it. But I don't know if it use "" for the DB Name as I have another DB which is created using quoted string. Commented Feb 24, 2014 at 10:46

2 Answers 2

1

You have a typo:

CREATE TABLE TestSchema.Emp (
                lastname VARCHAR(50) NOT NULL,
                firstname VARCHAR(10) NOT NULL,
                empid INTEGER PRIMARY KEY
}; -- Put ) instead of } 

Normally it does not work

Sign up to request clarification or add additional context in comments.

1 Comment

My bad I will fix the same and take a look again as I was learning PG programming but later didn't get much time to look into the issue.
0

Try to replace:

CREATE TABLE TestSchema.Emp (

By

CREATE TABLE testschema.Emp (

1 Comment

No, Postgres is not case-sensitive if the identifiers are not quoted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.