Maintenant que la base existe, il devient possible d'effectuer des
recherches SQL.
[root@cericon]# psql
-U finance
Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit finance=# select * from pg_tables; tablename | tableowner | hasindexes | hashrules | hastriggers ---------------+------------+------------+-----------+------------ pg_type | postgres | t | f | f pg_attribute | postgres | t | f | f pg_proc | postgres | t | f | f pg_class | postgres | t | f | f pg_group | postgres | t | f | f pg_database | postgres | f | f | f pg_variable | postgres | f | f | f pg_log | postgres | f | f | f pg_xactlock | postgres | f | f | f pg_attrdef | postgres | t | f | f pg_relcheck | postgres | t | f | f pg_trigger | postgres | t | f | f pg_inherits | postgres | t | f | f pg_index | postgres | t | f | f pg_statistic | postgres | t | f | f pg_operator | postgres | t | f | f pg_opclass | postgres | t | f | f pg_am | postgres | t | f | f pg_amop | postgres | t | f | f pg_amproc | postgres | f | f | f pg_language | postgres | t | f | f pg_aggregate | postgres | t | f | f pg_ipl | postgres | f | f | f pg_inheritproc | postgres | f | f | f pg_rewrite | postgres | t | f | f pg_listener | postgres | t | f | f pg_description | postgres | t | f | f pg_shadow | postgres | f | f | f (28 rows) |
Pour obtenir une liste des bases de données, essayez:
finance=# select
* from pg_database;
datname | datdba | encoding | datpath -----------+---------+----------+---------- template1 | 24 | 0 | template1 finance | 26 | 0 | finance (2rows) |