Closed VineethReddy02 closed 4 years ago
You could use the information_schema.tables
table, which contains metadata about each table.
@peterstace Is there any way I can list all the tables. something like /dt
& SHOW TABLES;
k, err := c.Session.Exec(fmt.Sprintf(` CREATE TABLE %s ( hash VARCHAR (50) PRIMARY KEY, range VARCHAR (50) NOT NULL, value VARCHAR (50) NOT NULL );`, "a4"))
I need a query like this for listing all the tables. But I couldn't understand. How I can do so and I stuck here.
I would appreciate the help here.
PostgreSQL doesn't have a SHOW TABLES
: https://www.postgresql.org/docs/current/sql-commands.html
You can use the ECHO_HIDDEN
variable in psql
to show the queries that drive \dt
and other commands: https://www.postgresql.org/docs/current/app-psql.html
psql> \set ECHO_HIDDEN on
psql> \dt
********* QUERY **********
SELECT n.nspname as "Schema",
…
Usually in postgres. We use
SHOW TABLES;
to list the tables. Can I know how can I list using pq client?r, err := c.Session.Query(fmt.Sprintf( "SHOW TABLES;"))
I see an error message saying:
unrecognized configuration parameter "tables"