Paul Taylor Paul Taylor - 1 year ago 59
SQL Question

How do you output comments in a postgres sql script

I'm running a large sql script with postgres as follows:

psql < scriptname.sql

Each sql statement has a comment explaining (using -- syntax) what it does but it isnt output, and its difficult to match up each statement with output. I simply want to output the comments together with the results of the statements

Answer Source

Search for the \echo command in the psql reference.

This is psql specific though...