Problem
Studio can export a selection from a table (copy as → copy/save Markdown or CSV), but the same selection in SQL view (#view=sql) can only be copied one cell or one range at a time as raw tabular text. There is no way to get a query result out of Studio as a file.
This is the shape of the problem for teams that use Studio as their day-to-day admin console: people write a query, get the rows they need on screen, and then have to paste cell by cell into a spreadsheet, or reach for psql/COPY — which is exactly the tool Studio replaced for them.
The gap looks accidental rather than deliberate: SQL results already run through the shared DataGrid, already carry a synthetic __ps_rowid, and already support the same row and cell-range selection modes as tables. Only the toolbar affordance is missing.
Proposed solution
Mount the existing copy as menu on the SQL result summary row, with exactly the behavior it has in table view:
- appears only while rows or a cell range are selected;
copy markdown, copy csv, save markdown, save csv;
include column header checked by default;
- honors the current grid column order and pinned columns;
- saved files are named after the source, e.g.
sql-result-selection.csv.
No new format and no new interaction to learn — the same menu, in the one view that does not have it.
Alternatives
- Selecting a rectangular range and copying it as tabular text, then repairing the columns in a spreadsheet. Works for a handful of rows, breaks on values containing tabs or newlines, and never carries column headers.
- Making the query itself produce the file, e.g.
select jsonb_agg(t) from (...) t and copying the single resulting cell. Robust, but it means teaching every user a SQL trick to work around a missing button.
- Leaving Studio for
psql \copy or a desktop client, which for hosted/managed setups means handing out database credentials that were deliberately kept server-side.
Related: #1560 asks for JSON in the same export menu. That is a separate (and complementary) request; this issue is only about making the existing formats reachable from SQL view.
I have a working patch for this and will open a PR against main if the direction is welcome.
Problem
Studio can export a selection from a table (
copy as→ copy/save Markdown or CSV), but the same selection in SQL view (#view=sql) can only be copied one cell or one range at a time as raw tabular text. There is no way to get a query result out of Studio as a file.This is the shape of the problem for teams that use Studio as their day-to-day admin console: people write a query, get the rows they need on screen, and then have to paste cell by cell into a spreadsheet, or reach for
psql/COPY— which is exactly the tool Studio replaced for them.The gap looks accidental rather than deliberate: SQL results already run through the shared
DataGrid, already carry a synthetic__ps_rowid, and already support the same row and cell-range selection modes as tables. Only the toolbar affordance is missing.Proposed solution
Mount the existing
copy asmenu on the SQL result summary row, with exactly the behavior it has in table view:copy markdown,copy csv,save markdown,save csv;include column headerchecked by default;sql-result-selection.csv.No new format and no new interaction to learn — the same menu, in the one view that does not have it.
Alternatives
select jsonb_agg(t) from (...) tand copying the single resulting cell. Robust, but it means teaching every user a SQL trick to work around a missing button.psql \copyor a desktop client, which for hosted/managed setups means handing out database credentials that were deliberately kept server-side.Related: #1560 asks for JSON in the same export menu. That is a separate (and complementary) request; this issue is only about making the existing formats reachable from SQL view.
I have a working patch for this and will open a PR against
mainif the direction is welcome.