Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct file extension I should use for a newly created PostgreSQL schema that I created?

Tags:

I have created a new schema for a new PostgreSQL DB that I want to create (IF NOT EXISTS).

What should the file extension be for this document so that I can run it from psql, .dbu or .sql?

like image 989
nasaQuant Avatar asked Jul 19 '17 15:07

nasaQuant


People also ask

What is the file extension for PostgreSQL?

Each PSQL database table is a separate file with a default file extension of . mkd.

How do I create a PostgreSQL schema?

PostgreSQL has a CREATE SCHEMA statement that is used to create a new schema in a database. Syntax: CREATE SCHEMA [IF NOT EXISTS] schema_name; Let's analyze the above syntax: First, specify the name of the schema after the CREATE SCHEMA keywords.

How do I show PostgreSQL extensions?

Get a list of all the extensions installed on a database by using the \dx command. For example, the output for \dx when run on the Databases for PostgreSQL default database shows the only installed extension.

What is a PostgreSQL schema?

Schema is a collection of logical structures of data. In PostgreSQL, schema is a named collection of tables, views, functions, constraints, indexes, sequences etc. PostgreSQL supports having multiple schemas in a single database there by letting you namespace different features into different schemas.


1 Answers

.dbu is used as a "Database Utility" file

You need to use .sql

Then from psql you can use something like:

SET search_path = schemaName, something_else; SELECT * FROM tableName;        -- schemaName.tableName 

or something to that effect depending on what you're trying to accomplish...

like image 126
lopezdp Avatar answered Sep 20 '22 13:09

lopezdp