Re: Protocol Question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Heller <info(at)zilence(dot)net>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Protocol Question
Date: 2014-08-11 15:06:19
Message-ID: 22826.1407769579@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Thomas Heller <info(at)zilence(dot)net> writes:
> The first 16 bits (well skip the first 40) in every DataRow ('D') packet
> refer to the number of columns following. Is there any way that this number
> is different from the number received in the RowDescription ('T')?

A quick look into libpq says that it doesn't support them being different:

/* Get the field count and make sure it's what we expect */
if (pqGetInt(&tupnfields, 2, conn))
{
/* We should not run out of data here, so complain */
errmsg = libpq_gettext("insufficient data in \"D\" message");
goto advance_and_error;
}

if (tupnfields != nfields)
{
errmsg = libpq_gettext("unexpected field count in \"D\" message");
goto advance_and_error;
}

> Currently I use an assert since I assume it always is the same, however I
> only have tested with a very limited dataset so far.

An assert seems overly optimistic. libpq has an explicit test with an
error recovery path, you should too.

regards, tom lane

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Thomas Heller 2014-08-12 15:58:45 Re: Protocol Question
Previous Message Thomas Heller 2014-08-11 14:03:58 Protocol Question