If you created a new schema using the Workbench tool in Panoply, you might notice it doesn't appear immediately in the list of schemas in the sidebar. Even if you refresh the page, it still won't get displayed. This is because using the
CREATE SCHEMA command to create a new schema will not yet have any tables or views within it. Only the schemas that have tables or views in them get listed.
Currently, the best way to verify if your new schema was indeed created is to run this query:
SELECT s.nspname AS schema_name FROM pg_catalog.pg_namespace s WHERE nspowner <> 1 AND schema_name = 'my_new_schema';
my_new_schema with the name of your new schema. If this query returns a result, then that means your schema does exist.
NOTE: For your new schema to have tables or views — and then get listed in the schemas list in the Workbench — you can follow these suggestions:
- Specify a data source that will write tables or views into your new schema. You can specify the target schema for any data source in Panoply by locating the Schema selection, under the Advanced options. All your created schemas are listed in the selection, whether or not they contain tables or views.
- For testing purposes only, manually create tables or views using the
CREATE VIEWstatements. And don't forget to use the name of your new schema as the schema qualifier.
For example, to create a
userstable under the
my_new_schemaschema, write it like this:
CREATE TABLE "my_new_schema"."users" ( id INT NOT NULL, name VARCHAR(50) );