Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwRgx-0006jY-F2 for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Jun 2021 15:54:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwRgv-0004y6-WF for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Jun 2021 15:54:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwRgv-0004uT-Kf for pgsql-hackers@lists.postgresql.org; Thu, 24 Jun 2021 15:54:57 +0000 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lwRgt-0007Ab-1U for pgsql-hackers@lists.postgresql.org; Thu, 24 Jun 2021 15:54:57 +0000 Received: by mail-qt1-x82b.google.com with SMTP id w26so5119964qto.13 for ; Thu, 24 Jun 2021 08:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=r94yHCKFb1rqQBCwxcAmT4t2N5Zs51hHaUdTKzQOwb4=; b=nzbk8r5o/wINnvIs6goPIx8L5vSjBoTmCA05o0Ae+JC5vA46+Xgg9LFaP3NnTTaUji dQYTUS+nV7eIisPdvgAe/iZuYvKss4wXH0tX+OfZxKe8V5kQuQCdVv63dSnbwG2Fg8dI QbHGB6qkJRC3rda953WALtJCd4gocQ4n3HFiWgqumlxVqTrVHC1eu+alVWduLiK9/r36 5w85hV60ToZwQ6gNnUXbkfXHRczAGboxQU2VM+Zn8CrUnJZPGbEaSzzMJh+QolYrZJCT yxBNLYM9WnmwHRQjpJC9/hu/a2tZQjArzWn4xnASvODwN6JHEXvvuV9Kwz0ZOyfZXaLc 9DTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=r94yHCKFb1rqQBCwxcAmT4t2N5Zs51hHaUdTKzQOwb4=; b=dD6PB2z1XOGB+Z5UtU87AGhlnZOqqCWXpK2+5GW8mP6JOZwQWk9NQZtcHUDqVA5/Bv CSMT6bTVLCQUjxc0crLjmWNT4wgfEGXoyTcmeAze2cwjh407CKSyj07WxMx+1z/jGaX4 EEofUF6PTRUZjALPSG6+kG4E7P7Vpr10K85Lu3Ob93cRjkUUNXV9oWZ6DXyd7HTdZB5d FWy4Z60Qqov41RyOm0T3blEEK9/hb4YgYbA7xdpkeqXeNyOUOrnXnPAl6axaxfrGnFxt 7ZjjwvmYqG1nYxugZ9lZeu9SMzIivAVZq9h47dK1JSH1g3UNEv7uo1KqCrfPvViosN8M j52Q== X-Gm-Message-State: AOAM532kvkjog+CjX7wQaIT7iVsNMG6vGrA0xUoaBIYxLdAg+0YU9+BX JyHjSWYvnGvz1PYoGHF9ZY0XSQ== X-Google-Smtp-Source: ABdhPJzzQBEXAHsg+wAma6gEcSNBB0XiTclhqYxP9bSzgDiyi00rMr6BZJ+OQCxZX0Ydxt03XcZ1Nw== X-Received: by 2002:a05:622a:198a:: with SMTP id u10mr2038414qtc.342.1624550093414; Thu, 24 Jun 2021 08:54:53 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.95]) by smtp.gmail.com with ESMTPSA id z188sm2939694qkd.68.2021.06.24.08.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 08:54:52 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 4DA232A0BBB; Thu, 24 Jun 2021 11:54:50 -0400 (-04) Date: Thu, 24 Jun 2021 11:54:50 -0400 From: Alvaro Herrera To: Boris Kolpackov Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Pipeline mode and PQpipelineSync() Message-ID: <202106241554.iu62tzrmrywa@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Jun-23, Boris Kolpackov wrote: > If, however, I execute it by checking for results before sending the > next INSERT, I get the following call sequence: > > PQsendQueryPrepared() # INSERT #1 > PQflush() > PQsendQueryPrepared() # INSERT #2 > PQflush() > ... > PQsendQueryPrepared() # INSERT #~400 > PQflush() > PQconsumeInput() # At this point select() indicates we can read. > PQgetResult() # NULL (???) > PQgetResult() # INSERT #1 > PQgetResult() # NULL > PQgetResult() # INSERT #2 > PQgetResult() # NULL > ... > > > What's strange here is that the first PQgetResult() call (marked with ???) > returns NULL instead of result for INSERT #1 as in the first call sequence. > Interestingly, if I skip it, the rest seems to progress as expected. Yeah, I agree that there's a problem in the libpq state machine. I'm looking into it now. -- Álvaro Herrera 39°49'30"S 73°17'W