Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

sql.postgres.results

import sql.postgres.results

sql lifts part of this module out to its own top level; each name below is shown with the path that reaches it. Anything still spelled sql.postgres.results.* needs import sql.postgres.results.

Reading what the server says about a result it has just produced.

These live apart from the connection so the statement can use them too. A statement that reached for them through the connection, which already reaches for the statement, would be a circular import.

Functions

affected_rows()

sql.postgres.affected_rows(tag) -> number

The number of rows a command tag reports.

The tag is the command’s name followed by its counts. INSERT 0 3 carries an unused OID before the row count and everything else carries the count alone, so the last field is the one to read. A tag with no count at all, as CREATE TABLE has, means no rows.

Parameters

  • tag (string)

Returns number

type_name_of()

sql.postgres.type_name_of(oid: number) -> string

The name of the type an OID stands for, or the OID as text for one this adapter has no name for, which is what an extension’s type will be.

Parameters

  • oid (number)

Returns string

describe_columns()

sql.postgres.describe_columns(columns: list) -> list[dict]

Reduces the server’s column descriptors to the two fields the shared contract asks for.

Parameters

  • columns (list)

Returns list[dict]


2026, Richard Ore and Zuri contributors