1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>54.6. Message Data Types</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="protocol-logical-replication.html" title="54.5. Logical Streaming Replication Protocol" /><link rel="next" href="protocol-message-formats.html" title="54.7. Message Formats" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">54.6. Message Data Types</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="protocol-logical-replication.html" title="54.5. Logical Streaming Replication Protocol">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="protocol.html" title="Chapter 54. Frontend/Backend Protocol">Up</a></td><th width="60%" align="center">Chapter 54. Frontend/Backend Protocol</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="protocol-message-formats.html" title="54.7. Message Formats">Next</a></td></tr></table><hr /></div><div class="sect1" id="PROTOCOL-MESSAGE-TYPES"><div class="titlepage"><div><div><h2 class="title" style="clear: both">54.6. Message Data Types <a href="#PROTOCOL-MESSAGE-TYPES" class="id_link">#</a></h2></div></div></div><p>
3 This section describes the base data types used in messages.
4 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int<em class="replaceable"><code>n</code></em>(<em class="replaceable"><code>i</code></em>)</span></dt><dd><p>
5 An <em class="replaceable"><code>n</code></em>-bit integer in network byte
6 order (most significant byte first).
7 If <em class="replaceable"><code>i</code></em> is specified it
8 is the exact value that will appear, otherwise the value
9 is variable. Eg. Int16, Int32(42).
10 </p></dd><dt><span class="term">Int<em class="replaceable"><code>n</code></em>[<em class="replaceable"><code>k</code></em>]</span></dt><dd><p>
11 An array of <em class="replaceable"><code>k</code></em>
12 <em class="replaceable"><code>n</code></em>-bit integers, each in network
13 byte order. The array length <em class="replaceable"><code>k</code></em>
14 is always determined by an earlier field in the message.
16 </p></dd><dt><span class="term">String(<em class="replaceable"><code>s</code></em>)</span></dt><dd><p>
17 A null-terminated string (C-style string). There is no
18 specific length limitation on strings.
19 If <em class="replaceable"><code>s</code></em> is specified it is the exact
20 value that will appear, otherwise the value is variable.
21 Eg. String, String("user").
22 </p><div class="note"><h3 class="title">Note</h3><p>
23 <span class="emphasis"><em>There is no predefined limit</em></span> on the length of a string
24 that can be returned by the backend. Good coding strategy for a frontend
25 is to use an expandable buffer so that anything that fits in memory can be
26 accepted. If that's not feasible, read the full string and discard trailing
27 characters that don't fit into your fixed-size buffer.
28 </p></div></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em>(<em class="replaceable"><code>c</code></em>)</span></dt><dd><p>
29 Exactly <em class="replaceable"><code>n</code></em> bytes. If the field
30 width <em class="replaceable"><code>n</code></em> is not a constant, it is
31 always determinable from an earlier field in the message.
32 If <em class="replaceable"><code>c</code></em> is specified it is the exact
33 value. Eg. Byte2, Byte1('\n').
34 </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="protocol-logical-replication.html" title="54.5. Logical Streaming Replication Protocol">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="protocol.html" title="Chapter 54. Frontend/Backend Protocol">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="protocol-message-formats.html" title="54.7. Message Formats">Next</a></td></tr><tr><td width="40%" align="left" valign="top">54.5. Logical Streaming Replication Protocol </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 54.7. Message Formats</td></tr></table></div></body></html>