Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XGrB5-0001Ox-5c for pgsql-interfaces@arkaria.postgresql.org; Mon, 11 Aug 2014 15:06:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XGrB4-0008IS-Lj for pgsql-interfaces@arkaria.postgresql.org; Mon, 11 Aug 2014 15:06:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XGrB4-0008IM-3k for pgsql-interfaces@postgresql.org; Mon, 11 Aug 2014 15:06:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XGrB0-0006rj-Rc for pgsql-interfaces@postgresql.org; Mon, 11 Aug 2014 15:06:25 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s7BF6JBO022827; Mon, 11 Aug 2014 11:06:19 -0400 From: Tom Lane To: Thomas Heller cc: pgsql-interfaces@postgresql.org Subject: Re: Protocol Question In-reply-to: References: Comments: In-reply-to Thomas Heller message dated "Mon, 11 Aug 2014 16:03:58 +0200" Date: Mon, 11 Aug 2014 11:06:19 -0400 Message-ID: <22826.1407769579@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-interfaces Precedence: bulk Sender: pgsql-interfaces-owner@postgresql.org Thomas Heller 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 -- Sent via pgsql-interfaces mailing list (pgsql-interfaces@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-interfaces