Displaying a database table: the row-list buffer

A row-list buffer shows some metainformation on the table and its columns, then the row data in tabular form, as illustrated below.

Screenshot table

If the table contains a large number of rows, the contents will be paginated, with Next and Previous buttons to move page by page. The number of rows in each page is determined by the variable pgmacs-row-limit.

A column which is a part of a primary key will be displayed using the customizable pgmacs-column-primary-key face, which defaults to a bold version of the pgmacs-table-data face. A column which references a foreign key will be displayed using the pgmacs-column-foreign-key face, which defaults to a blue color.

The following keys are bound when the point is located in the row-list table:

KeyBinding
vDisplay the value at point in a dedicated buffer.
RETEdit the value at point in the minibuffer, or jump to foreign table.
wEdit the value at point in a widget-based buffer.
!Run a shell command on the value at point, replacing the output if prefix argument.
M-uUpcase the content of the current cell and update PostgreSQL.
M-lDowncase the content of the current cell and update PostgreSQL.
M-cCapitalize the content of the current cell and update PostgreSQL.
DELDelete the row at point.
M-leftMove to the previous column.
M-rightMove to the next column.
oPrompt for a table name and open a new buffer displaying that table’s data.
+Insert a new row into the current table, prompting for new values in the minibuffer.
iInsert a new row, prompting for new values in a dedicated buffer.
kCopy the current row.
yPaste (yank) the copied row.
jCopy the current row to the kill ring in JSON format.
RRename the current column.
<Move point to the first row of data.
>Move point to the last row of data.
numberMove point to the nth column (numbering is zero-based).
eOpen a new buffer to display the result of an SQL query.
EExecute SQL from an Emacs buffer and display the output.
rRedraw the table (does not refetch data from PostgreSQL).
nNext page of output (if table contents are paginated).
pPrevious page of output (if table contents are paginated).
SSort the table by the current column.
{Make the current column narrower.
}Make the current column wider.
TJump to the main PGmacs table-list buffer.
qKill the current buffer.

Follow foreign key references

A column that references data in a foreign table (FOREIGN KEY) will be shown in blue. If you type RET when point is located on a foreign key reference, PGmacs will jump to the referenced row and column in the other table. A new row-list buffer is opened; type q to come back to the original row-list buffer.

Following foreign key