PgNotice

data class PgNotice(val processId: Int, val severity: String, val localizedSeverity: String, val code: String, val message: String, val detail: String?, val hint: String?, val position: Int?, val internalPosition: Int?, val internalQuery: String?, val where: String?, val schema: String?, val table: String?, val column: String?, val datatype: String?, val constraint: String?, val file: String?, val line: Int?, val routine: String?)

Represents a notice or warning message received from the PostgreSQL backend.

A NoticeResponse carries the same field set as an ErrorResponse, so this holds the same fields ServerErrorMessage does, under the same names. Which of them arrive depends on what raised the notice: file, line and routine come with every one, while schema, table, column, datatype and constraint are what RAISE ... USING puts there.

Constructors

Link copied to clipboard
constructor(processId: Int, severity: String, localizedSeverity: String, code: String, message: String, detail: String?, hint: String?, position: Int?, internalPosition: Int?, internalQuery: String?, where: String?, schema: String?, table: String?, column: String?, datatype: String?, constraint: String?, file: String?, line: Int?, routine: String?)

Types

Link copied to clipboard
internal object Companion

Properties

Link copied to clipboard

The five-character SQLSTATE

Link copied to clipboard

The column it concerns.

Link copied to clipboard

The constraint it concerns.

Link copied to clipboard

The data type it concerns.

Link copied to clipboard

Secondary detail carrying more about the problem.

Link copied to clipboard
val file: String?

The PostgreSQL source file that reported it - server internals, not your SQL.

Link copied to clipboard
val hint: String?

A suggestion of what to do about it.

Link copied to clipboard

The equivalent position within internalQuery.

Link copied to clipboard

The server-generated statement the notice arose in, such as the body of a PL/pgSQL function.

Link copied to clipboard
val line: Int?

The line in that source file.

Link copied to clipboard

The same severity as the server translated it, which is what a non-English lc_messages changes. Fit for showing to a person, not for comparing against.

Link copied to clipboard

The primary human-readable message.

Link copied to clipboard

The 1-based character position of the offending token in the submitted statement.

Link copied to clipboard

Process id of the backend serving this connection, the one that raised the notice. It is not a field of the NoticeResponse message - the driver carries it over from the BackendKeyData received at startup, so a notice arriving before that one reports -1. That window is a single message wide and nothing reaches it at the default verbosity; connecting with client_min_messages=debug5 fills it with the backend's own catalog-reading transaction. What it is for is a handler shared between connections: a Kotlin object NoticeHandler sees the notices of every connection in a pool, and this is what tells them apart. Note that PgNotification carries a process id of its own meaning something else - the foreign backend that executed NOTIFY, not this connection's.

Link copied to clipboard

The PostgreSQL C function that reported it.

Link copied to clipboard

The schema of the object the notice concerns.

Link copied to clipboard

NOTICE, WARNING, INFO, DEBUG or LOG, always in English: it is taken from the non-localized field, which every server the driver will talk to sends. Safe to compare as a string.

Link copied to clipboard

The table it concerns.

Link copied to clipboard

Where it arose - the call stack of a PL/pgSQL function, for one.

Functions

Link copied to clipboard
open override fun toString(): String