Meta Query - Select the SELECT expression as a string field
You can use the current_query function:
SELECT *, current_query() FROM generate_series(1, 10) AS n;

 n  |                        current_query                        
----+-------------------------------------------------------------
  1 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
  2 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
  3 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
  4 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
  5 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
  6 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
  7 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
  8 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
  9 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
 10 | SELECT *, current_query() FROM generate_series(1, 10) AS n;
(10 rows)