Click here to Skip to main content
15,899,937 members
Home / Discussions / Database
   

Database

 
AnswerRe: List all tables from a specific database Pin
k505412-Jan-22 1:35
mvek505412-Jan-22 1:35 
You can get Postgres to tell you how to do that using the -E (display hidden queries) option to psql. So for example
Shell
$ psql -E -l
********* QUERY **********
SELECT d.datname as "Name",
       pg_catalog.pg_get_userbyid(d.datdba) as "Owner",
       pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding",
       d.datcollate as "Collate",
       d.datctype as "Ctype",
       pg_catalog.array_to_string(d.datacl, E'\n') AS "Access privileges"
FROM pg_catalog.pg_database d
ORDER BY 1;
<hr />

                                  List of databases
   Name    |  Owner   | Encoding  |   Collate   |    Ctype    |   Access privileges   
-----------+----------+-----------+-------------+-------------+-----------------------
 template0 | postgres | UTF8      | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres          +
           |          |           |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8      | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres          +
           |          |           |             |             | postgres=CTc/postgres
 test      | ebacon   | UTF8      | en_CA.UTF-8 | en_CA.UTF-8 | 
(3 rows)
Likewise for the
\dt<dt> command inside psql.  Then all you need to do is to figure out how to combine both queries into one.<br />

<div class="signature">Keep Calm and Carry On</div></dt>

GeneralRe: List all tables from a specific database Pin
_Flaviu12-Jan-22 1:59
_Flaviu12-Jan-22 1:59 
GeneralRe: List all tables from a specific database Pin
k505412-Jan-22 4:13
mvek505412-Jan-22 4:13 
GeneralRe: List all tables from a specific database Pin
_Flaviu12-Jan-22 4:32
_Flaviu12-Jan-22 4:32 
GeneralRe: List all tables from a specific database Pin
Richard MacCutchan12-Jan-22 4:39
mveRichard MacCutchan12-Jan-22 4:39 
GeneralRe: List all tables from a specific database Pin
_Flaviu12-Jan-22 5:19
_Flaviu12-Jan-22 5:19 
GeneralRe: List all tables from a specific database Pin
Richard MacCutchan12-Jan-22 5:41
mveRichard MacCutchan12-Jan-22 5:41 
GeneralRe: List all tables from a specific database Pin
_Flaviu12-Jan-22 6:16
_Flaviu12-Jan-22 6:16 
GeneralRe: List all tables from a specific database Pin
Richard MacCutchan12-Jan-22 6:43
mveRichard MacCutchan12-Jan-22 6:43 
AnswerRe: List all tables from a specific database Pin
Sakshi Jain 202212-Jul-22 23:18
Sakshi Jain 202212-Jul-22 23:18 
QuestionWampServer localhost Pin
_Flaviu6-Jan-22 6:59
_Flaviu6-Jan-22 6:59 
AnswerRe: WampServer localhost Pin
Graham Breach6-Jan-22 21:10
Graham Breach6-Jan-22 21:10 
GeneralRe: WampServer localhost Pin
_Flaviu6-Jan-22 23:53
_Flaviu6-Jan-22 23:53 
QuestionSQLite sqlite_schema missing Pin
_Flaviu4-Jan-22 4:20
_Flaviu4-Jan-22 4:20 
AnswerRe: SQLite sqlite_schema missing Pin
Richard Deeming4-Jan-22 4:40
mveRichard Deeming4-Jan-22 4:40 
GeneralRe: SQLite sqlite_schema missing Pin
_Flaviu4-Jan-22 7:16
_Flaviu4-Jan-22 7:16 
GeneralRe: SQLite sqlite_schema missing Pin
_Flaviu4-Jan-22 7:17
_Flaviu4-Jan-22 7:17 
QuestionDate and Time Add Incompatibility between sql 2012 and sql 2018 Pin
Medo-I23-Dec-21 7:42
Medo-I23-Dec-21 7:42 
AnswerRe: Date and Time Add Incompatibility between sql 2012 and sql 2018 Pin
Richard Andrew x6423-Dec-21 8:56
professionalRichard Andrew x6423-Dec-21 8:56 
QuestionRe: Date and Time Add Incompatibility between sql 2012 and sql 2018 Pin
CHill6029-Dec-21 5:31
mveCHill6029-Dec-21 5:31 
AnswerRe: Date and Time Add Incompatibility between sql 2012 and sql 2018 Pin
jschell29-Dec-21 7:34
jschell29-Dec-21 7:34 
AnswerRe: Date and Time Add Incompatibility between sql 2012 and sql 2018 Pin
Richard Deeming4-Jan-22 0:44
mveRichard Deeming4-Jan-22 0:44 
QuestionRoelf Pin
floris rudolf vieira22-Dec-21 6:58
floris rudolf vieira22-Dec-21 6:58 
AnswerRe: Roelf Pin
jschell23-Dec-21 6:12
jschell23-Dec-21 6:12 
AnswerRe: Roelf Pin
0x01AA5-Jan-22 4:44
mve0x01AA5-Jan-22 4:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.