Psql: Difference between revisions

From annawiki
No edit summary
No edit summary
Line 36: Line 36:
  There are different kinds of privileges: SELECT, INSERT, UPDATE,  
  There are different kinds of privileges: SELECT, INSERT, UPDATE,  
  DELETE, TRUNCATE, REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, and USAGE.
  DELETE, TRUNCATE, REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, and USAGE.
No "Create DB" nor "CREATEDB"
No "Create DB" nor "CREATEDB", but it is not claimed that this list is complete.
  For complete information on the different types of privileges  
  For complete information on the different types of privileges  
  supported by PostgreSQL, refer to the GRANT reference page.
  supported by PostgreSQL, refer to the GRANT reference page.
Refer to? It would be nice to have a list of all "different types of privileges supported by PostgreSQL". Anyway, look at http://www.postgresql.org/docs/9.3/static/sql-grant.html
Refer to? It would be nice to have a complete list of all "different types of privileges supported by PostgreSQL". Anyway, look at http://www.postgresql.org/docs/9.3/static/sql-grant.html
* "CREATEDB" not found on that page
* "CREATEDB" not found on that page

Revision as of 2013-11-21T11:05:20

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"

Try without test2

tobiasco@main:/root$ psql CREATE DATABASE;
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?

There are different kinds of privileges: SELECT, INSERT, UPDATE, 
DELETE, TRUNCATE, REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, and USAGE.

No "Create DB" nor "CREATEDB", but it is not claimed that this list is complete.

For complete information on the different types of privileges 
supported by PostgreSQL, refer to the GRANT reference page.

Refer to? It would be nice to have a complete list of all "different types of privileges supported by PostgreSQL". Anyway, look at http://www.postgresql.org/docs/9.3/static/sql-grant.html

  • "CREATEDB" not found on that page