> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-vortex-format.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Documentation for the PostgreSQLWire format

# PostgreSQLWire

| Input | Output | Alias |
| ----- | ------ | ----- |
| ✗     | ✔      |       |

<h2 id="description">
  Description
</h2>

The `PostgreSQLWire` format serializes the result-set portion of the PostgreSQL wire protocol. It writes a
`RowDescription` message containing column names and types, followed by one `DataRow` message for each result row.
Values use their text representation, `NULL` values use the protocol's null-field encoding, and booleans are written as
`t` or `f`.

This is an output-only binary format intended for clients connected through ClickHouse's
[PostgreSQL interface](/concepts/features/interfaces/postgresql). The interface sets `PostgreSQLWire` as the session
default and uses it when the query doesn't include an explicit `FORMAT` clause. An explicit clause overrides the default;
other output formats don't produce a valid PostgreSQL result set. The interface writes the surrounding protocol messages,
such as authentication, command completion, and ready-for-query messages. `PostgreSQLWire` isn't intended for displaying
or storing query results as a standalone file.

<h2 id="example-usage">
  Example usage
</h2>

After enabling the PostgreSQL interface, use a compatible client to execute a query:

```shell theme={null}
psql -p 9005 -h 127.0.0.1 -U default -d default \
    -c "SELECT number, number % 2 = 0 AS even FROM numbers(3)"
```

Because the query doesn't specify a `FORMAT` clause, the interface sends the result using `PostgreSQLWire`.

<h2 id="format-settings">
  Format settings
</h2>

`PostgreSQLWire` uses the standard text-serialization settings for individual values. It has no settings specific to the
format itself; booleans are always serialized using PostgreSQL's `t` and `f` representations.
