Skip to main content
Tweeted twitter.com/StackDBAs/status/839924455031848962
edited tags
Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496
edited title
Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496

SQL Comments anddisappear with psql? and `\e`

Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496

Comments and psql?

Is there anyway at all, ever to change the behavior of comments in psql. Take the query below. Execute it.

CREATE TABLE foo
AS
  SELECT x AS id,
    -- x AS id2,
    x AS id3
  FROM generate_series(1,50) AS x;

Run that in psql. Then run \e. Now at least, for me what I see in my editor is the line absent. This is driving me crazy. Is there a way around this.. The comment is just absent from the buffer that gets passed to the editor. Often, it's commented and not deleted because I want to uncomment it at a later point.

Comment gone