I have an SQL file which extracts data from a PostgreSQL database in a particular format. However, I'm getting query "decoration", specifically a "SELECT N" output when creating my temporary tables.
This is an example SQL file.
create temporary table a as
select 1 as the_code, 'Test'::text as the_name;
create temporary table b as
select 2 as the_code, 'Foo'::text as the_name;
select * from a union all
select * from b;
And this is the example output, produced with psql --tuples-only --no-align --file query.sql
:
SELECT 1
SELECT 1
1|Test
2|Foo
Note that this question is separate from How to hide result set decoration in Psql output in that it is in relation to different query "decoration". That is, my question is how to remove the "SELECT N", while the existing question is how to remove the column headers and "(n rows)" footer.
EDIT
As a workaround, I could use common table expressions (CTEs) from which the select is run, but it'd be nice if there was a solution to the above so I don't have to rework my exiting SQL.