Psql: Difference between revisions

From annawiki
Line 14: Line 14:
  test->
  test->


==List roles==
==List of roles==
  test-> \dg
  test-> \dg
                               List of roles
                               List of roles
Line 30: Line 30:
* Clicking that result leads to http://www.postgresql.org/docs/9.3/static/functions-info.html, the first result for in-page search repeats the above sentence, with hyperlink to the http://www.postgresql.org/docs/9.3/static/ddl-priv.html
* Clicking that result leads to http://www.postgresql.org/docs/9.3/static/functions-info.html, the first result for in-page search repeats the above sentence, with hyperlink to the http://www.postgresql.org/docs/9.3/static/ddl-priv.html
* On that page it says 'PostgreSQL 9.3.1 Documentation [...] 5.6. Privileges', the word section is only found in " The following sections and chapters will also show you how those privileges are used.". So maybe "5.6" here is the "Section 5.6"
* On that page it says 'PostgreSQL 9.3.1 Documentation [...] 5.6. Privileges', the word section is only found in " The following sections and chapters will also show you how those privileges are used.". So maybe "5.6" here is the "Section 5.6"
* "There are different kinds of privileges: SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, and USAGE." - no "Create DB" nor "CREATEDB"

Revision as of 2013-11-21T10:53:08

Create database

tobiasco@main:/root$ psql CREATE DATABASE test2;
psql: warning: extra command-line argument "test2" ignored
psql: FATAL:  Peer authentication failed for user "DATABASE"

Create table

tobiasco@main:/root$ psql test
psql (9.3.1)
Type "help" for help.
 
test=> CREATE TABLE testtable
test-> \dt test
No matching relations found.
test->

List of roles

test-> \dg
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 gis       |                                                | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}
 tobiasco  | Create DB                                      | {}

But http://www.postgresql.org/docs/9.3/static/sql-createdatabase.html says

"To create a database, you must be a superuser or have the special CREATEDB privilege."

Where to find "privilege"-listing?