<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Message Data Types</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 9.6.4 Documentation" HREF="index.html"><LINK REL="UP" TITLE="Frontend/Backend Protocol" HREF="protocol.html"><LINK REL="PREVIOUS" TITLE="Streaming Replication Protocol" HREF="protocol-replication.html"><LINK REL="NEXT" TITLE="Message Formats" HREF="protocol-message-formats.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2017-08-11T02:27:18"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="4" ALIGN="center" VALIGN="bottom" ><A HREF="index.html" >PostgreSQL 9.6.4 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="Streaming Replication Protocol" HREF="protocol-replication.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="protocol.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Chapter 51. Frontend/Backend Protocol</TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="Message Formats" HREF="protocol-message-formats.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="PROTOCOL-MESSAGE-TYPES" >51.4. Message Data Types</A ></H1 ><P >This section describes the base data types used in messages. <P ></P ></P><DIV CLASS="VARIABLELIST" ><DL ><DT >Int<TT CLASS="REPLACEABLE" ><I >n</I ></TT >(<TT CLASS="REPLACEABLE" ><I >i</I ></TT >)</DT ><DD ><P > An <TT CLASS="REPLACEABLE" ><I >n</I ></TT >-bit integer in network byte order (most significant byte first). If <TT CLASS="REPLACEABLE" ><I >i</I ></TT > is specified it is the exact value that will appear, otherwise the value is variable. Eg. Int16, Int32(42).</P ></DD ><DT >Int<TT CLASS="REPLACEABLE" ><I >n</I ></TT >[<TT CLASS="REPLACEABLE" ><I >k</I ></TT >]</DT ><DD ><P > An array of <TT CLASS="REPLACEABLE" ><I >k</I ></TT > <TT CLASS="REPLACEABLE" ><I >n</I ></TT >-bit integers, each in network byte order. The array length <TT CLASS="REPLACEABLE" ><I >k</I ></TT > is always determined by an earlier field in the message. Eg. Int16[M].</P ></DD ><DT >String(<TT CLASS="REPLACEABLE" ><I >s</I ></TT >)</DT ><DD ><P > A null-terminated string (C-style string). There is no specific length limitation on strings. If <TT CLASS="REPLACEABLE" ><I >s</I ></TT > is specified it is the exact value that will appear, otherwise the value is variable. Eg. String, String("user").</P ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >There is no predefined limit</I ></SPAN > on the length of a string that can be returned by the backend. Good coding strategy for a frontend is to use an expandable buffer so that anything that fits in memory can be accepted. If that's not feasible, read the full string and discard trailing characters that don't fit into your fixed-size buffer.</P ></BLOCKQUOTE ></DIV ></DD ><DT >Byte<TT CLASS="REPLACEABLE" ><I >n</I ></TT >(<TT CLASS="REPLACEABLE" ><I >c</I ></TT >)</DT ><DD ><P > Exactly <TT CLASS="REPLACEABLE" ><I >n</I ></TT > bytes. If the field width <TT CLASS="REPLACEABLE" ><I >n</I ></TT > is not a constant, it is always determinable from an earlier field in the message. If <TT CLASS="REPLACEABLE" ><I >c</I ></TT > is specified it is the exact value. Eg. Byte2, Byte1('\n').</P ></DD ></DL ></DIV ><P></P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="protocol-replication.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="protocol-message-formats.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Streaming Replication Protocol</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="protocol.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Message Formats</TD ></TR ></TABLE ></DIV ></BODY ></HTML >