vol7ron
vol7ron

Reputation: 42099

PostgreSQL: Outputting query of underlying function

Someone once mentioned a way to make Postgres verbose, so that if you did \dt it would display all the underlying SQL.

I thought it was connected with -a or -e to echo the SQL, but I was wrong. I seem to have forgotten that method and have tried to look it up without any luck:
http://www.postgresql.org/docs/current/static/app-psql.html


Edit:

I thought because this was database/sql related it was for stackoverflow, but this may need to be moved to [Super Users|Server Fault|Database Administrators] (?)

Upvotes: 6

Views: 2692

Answers (2)

Vignesh Raja
Vignesh Raja

Reputation: 8741

To show the queries of internal commands,

Method 1 : psql -E - including -E option while opening the console.

Method 2 : \set ECHO_HIDDEN noexec/on/off, can be used while in session. noexec means it doesn't run the query, just prints it.

Upvotes: 8

wildplasser
wildplasser

Reputation: 44230

snipped from the output of psql --help:

  -e, --echo-queries       echo commands sent to server
  -E, --echo-hidden        display queries that internal commands generate

Upvotes: 5

Related Questions