Skip to content

Copy results

You can copy the cells you selected, or a whole result, as plain tab-separated text for a spreadsheet or in one of five other formats. pgjumbo’s engine writes the text from the rows it holds, so every digit of a bigint or a numeric arrives as the server sent it. To write a result to a file instead, see Save results to a file.

Select cells, rows or columns in the grid (see Select cells, rows and columns), then:

  • Press ⌘ C (Ctrl+C on Windows and Linux) to copy them as tab-separated text, without the column names.
  • Press ⌘ ⇧ C (Ctrl+Shift+C on Windows and Linux) for Copy with Headers: the same, with the column names on the first line.
  • Or right-click the selection and choose from the menu.
The grid's right-click menu over a selection of three rows and two columns, with Copy, Copy with Headers and Copy As, whose submenu lists CSV, JSON, Markdown table, INSERT statements and IN (…) list of created_at.The grid's right-click menu over a selection of three rows and two columns, with Copy, Copy with Headers and Copy As, whose submenu lists CSV, JSON, Markdown table, INSERT statements and IN (…) list of created_at.
  • 1 Copy: the selected cells as tab-separated text.
  • 2 Copy with Headers: the same under a line of column names.
  • 3 Copy As opens the list of formats.
  • 4 CSV, JSON, Markdown table and INSERT statements write the selected rows and columns in that format. See The formats.
  • 5 IN (…) list of created_at writes the values of one column: the column of the cell with the outline, which the item names.

The keys work whenever the grid has the keyboard, even while some text elsewhere in the window is highlighted: the grid copies its cells, never the window’s text. A field inside the grid, such as Find or a cell you are editing, copies its own text.

Two buttons in the result bar copy every row of the result in front.

The result bar with the Copy as menu open: CSV, JSON, Markdown table, INSERT statements, and IN (…) list of a column, whose submenu lists the columns id, customer_id, created_at and total.The result bar with the Copy as menu open: CSV, JSON, Markdown table, INSERT statements, and IN (…) list of a column, whose submenu lists the columns id, customer_id, created_at and total.
  • 1 Copy: every row as tab-separated text, with the column names on the first line.
  • 2 Copy as opens the same formats for the whole result.
  • 3 CSV, JSON, Markdown table and INSERT statements write every row.
  • 4 IN (…) list of a column opens the list of the result’s columns.
  • 5 Choose the column whose values you want.

The two buttons take every column of the result, in the order the query returned them, hidden columns too. To copy the columns as you arranged them, select them in the grid (⌘ A (Ctrl+A on Windows and Linux) selects everything shown) and copy the selection.

While the result is shown as text, Copy takes the text as it is laid out, and Copy as is not offered. See Results as text.

  • Values go as the server wrote them, however SettingsResultsHow values look makes them look in the grid. A number the grid shows as 1 234 567.89 is copied as 1234567.89.
  • A copy follows the grid’s sort and filter: the rows go in the order shown, and rows the filter hides are left out. See Sort, filter and arrange columns.
  • A copy takes the rows the result holds. Rows a large result has not read from the server are not in it: see Large results.
  • Rows you added and have not saved are not copied, and a value you changed is copied as it was read, until you save.
  • A long value is copied whole, not the shortened start the cell shows.
  • The text reaches the clipboard exactly as pgjumbo wrote it. A line break inside a value stays the line break the database holds, so a value copied here and pasted into a table’s rows comes back the same, byte for byte.

After a copy, the result bar says for a few seconds what went to the clipboard.

The result bar after a copy: the line Copied 3 rows × 2 columns as CSV under the result tabs.The result bar after a copy: the line Copied 3 rows × 2 columns as CSV under the result tabs.
  • 1 Copied 3 rows × 2 columns as CSV. A plain copy says Copied 3 rows × 2 columns, the bar’s Copy says Copied 50 rows, and an IN list names its column: Copied customer_id of 50 rows as an IN list. If the clipboard refuses, the bar says Could not copy: and why.

The examples copy two rows and three columns of an orders table. The second row has no customer.

What Copy and Copy with Headers write: one line per row, a tab between values. A spreadsheet pastes it into separate cells.

id customer_id total
1004 4 29.25
1005 32.50
  • A NULL is an empty field. An empty string is written "", so the two stay apart, and pasting the text back into a grid gives each cell what it had (see Edit data).
  • A value that holds a tab, a line break or a double quote is put in double quotes, with its own double quotes doubled, the way spreadsheets read it.

As PostgreSQL’s COPY writes CSV, under a line of column names.

id,customer_id,total
1004,4,29.25
1005,,32.50
  • A NULL is an empty field, and an empty string is "".
  • A field that holds a comma, a double quote or a line break is quoted.

An array with one object per row.

[
{"id": 1004, "customer_id": 4, "total": 29.25},
{"id": 1005, "customer_id": null, "total": 32.50}
]
  • Numbers and booleans are written bare, with every digit the server sent. A value that JSON has no number for, such as NaN, is written as a string.
  • json and jsonb values go in as they are, not as text inside quotes.
  • A NULL is null.
  • When two columns have the same name, the second is named with _2, the third with _3, so no value is lost.

A table for a ticket, a wiki page or a chat that reads Markdown.

| id | customer_id | total |
|---:|---:|---:|
| 1004 | 4 | 29.25 |
| 1005 | | 32.50 |
  • Number columns line up on the right.
  • A NULL is an empty cell, a | inside a value is escaped, and a line break becomes <br>.

One INSERT per row.

INSERT INTO public.orders (id, customer_id, total) VALUES (1004, 4, 29.25);
INSERT INTO public.orders (id, customer_id, total) VALUES (1005, NULL, 32.50);
  • When every copied column comes from one table, the statements name that table and its columns, quoted where PostgreSQL needs it. Otherwise they insert into table_name, for you to change.
  • Numbers and booleans are written bare, everything else as a quoted literal, and a NULL as NULL.

The different values of one column, in parentheses, ready to put after IN in a WHERE.

(1, 2, 3, 4)
  • Each value is listed once, in the order it first comes.
  • NULLs are left out, as IN never matches them.
  • Text is quoted: ('retail', 'wholesale', 'vip').

The clipboard takes a copy as one piece of text. When a copy would hold more than 200,000 rows, pgjumbo asks before it starts, whether you used a key, a menu or the result bar.

The dialog Copy 250,000 rows?: the clipboard takes them as one piece of text, which can stop pgjumbo for a while and fill the clipboard; Export writes them to a file instead. Its buttons are Cancel, Copy Anyway and Export to a File.The dialog Copy 250,000 rows?: the clipboard takes them as one piece of text, which can stop pgjumbo for a while and fill the clipboard; Export writes them to a file instead. Its buttons are Cancel, Copy Anyway and Export to a File.
  • 1 Copy Anyway copies the rows. pgjumbo can stop answering for a moment while the text goes to the clipboard.
  • 2 Export to a File… opens the Export dialog for this result instead. It is the button Enter chooses. See Save results to a file.

Cancel, Esc or the × copies nothing.