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 1lyECX-0003o3-DB for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jun 2021 13:54:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lyECW-0007rp-28 for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jun 2021 13:54:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyECV-0007rR-LK for pgsql-hackers@lists.postgresql.org; Tue, 29 Jun 2021 13:54:55 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lyECT-000665-7S for pgsql-hackers@lists.postgresql.org; Tue, 29 Jun 2021 13:54:54 +0000 Received: by mail-pl1-x636.google.com with SMTP id d1so10311167plg.6 for ; Tue, 29 Jun 2021 06:54:52 -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=1IVct3HC9MI9W7kms3JxAM+eKKHQO8UVdWvH3NmyyzM=; b=uvPQdHSLUcWD7Hl0XsjjLIE6tewio4hm6t9ICREFS0+k6os/Xr3Fgv5+rNKOACEq3y YOVPzCvlOS+NbUgvxkANKSFnqVIx0NDmZe1q045tST0JxBiSrhx25nxms8Y3pLx0Db8y Ca2KdhHaFnVMj62FkQ/etJ5HyNuVCPc8SRLJAfMIcFs6e3ZeMQ/5nhP5o+imQSqsolxq KEr0w7YEJ6CphlSqOrXRuLg9TEZ4GpSQCmYaZUHuoAz9nbWDA+1Lto/d4tUiJ5bDPfw6 wmiMAsPmoBdZOgjLxqC6TJNU1cVMs5uac1V2sgfY3zUz7onmu/JjHkEs60AS5eYdh7PP /jpg== 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=1IVct3HC9MI9W7kms3JxAM+eKKHQO8UVdWvH3NmyyzM=; b=cELAtZFC2gbQ6mDDl4+x0vqxNv8OIJxmOJuKLltFGy+0MgdwtAFhBLjeP3RpQNWiel LNcDSXfEDQw07yN6LMYZNXmFIpCmAcEoNl+Z74qMN1g6ZlBY/sZMmjzeZ3HWyn74D7uO U7Vwf9O7VbXhfXCYNZ7AatXWXT6Y38DhgZuX/rpTCwG8VTFaPL7bBLjnu5D9dW3IQuxx weWa9Gu8lDiiOuWvF1dgAAN+il6nXieVNMBS7A+QivoSs+426kPnifZJs8vj6hjeEDQ1 rHZNvqtFt4oqCPQJ5iL2t1ah5B8T5rr5FgVGoNKI7MIRvZBy/S9EpXB4su4u/w+v1E4l QY4Q== X-Gm-Message-State: AOAM533qCo7KGVo4YupaQ1nzKLWS7jDyaKl2/tJEQfsHrckCTR5XS/r7 7ydKAZdsEVrjGH9FGoOt7d9oliN7OZ1xVg== X-Google-Smtp-Source: ABdhPJwqzJTEGMSzZU9Oocv5N7AOujLjmlRhubERN0lSON7obTvDZo57DLDpNxhNqH5cwm3YcjH/fQ== X-Received: by 2002:a17:90a:c916:: with SMTP id v22mr5984661pjt.47.1624974892018; Tue, 29 Jun 2021 06:54:52 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.95]) by smtp.gmail.com with ESMTPSA id b6sm17991206pfo.64.2021.06.29.06.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 06:54:51 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 46C3A2A07E0; Tue, 29 Jun 2021 09:54:49 -0400 (-04) Date: Tue, 29 Jun 2021 09:54:49 -0400 From: Alvaro Herrera To: Boris Kolpackov Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Pipeline mode and PQpipelineSync() Message-ID: <202106291354.wyn7ar6emdm6@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-24, Boris Kolpackov wrote: > I've hit another similar case except now an unexpected NULL result is > returned in the middle of PGRES_PIPELINE_ABORTED result sequence. The > call sequence is as follows: > > PQsendQueryPrepared() # INSERT #1 > PQflush() > PQsendQueryPrepared() # INSERT #2 > PQflush() > ... > PQsendQueryPrepared() # INSERT #251 -- insert duplicate PK > PQflush() > ... > PQsendQueryPrepared() # INSERT #343 > PQflush() > PQconsumeInput() # At this point select() indicates we can read. > PQgetResult() # NULL -- unexpected but skipped (see prev. email) > PQgetResult() # INSERT #1 > PQgetResult() # NULL > PQgetResult() # INSERT #2 > PQgetResult() # NULL > ... > PQgetResult() # INSERT #251 error result, SQLSTATE 23505 > PQgetResult() # NULL > PQgetResult() # INSERT #252 PGRES_PIPELINE_ABORTED > PQgetResult() # NULL > PQgetResult() # INSERT #253 PGRES_PIPELINE_ABORTED > PQgetResult() # NULL > ... > PQgetResult() # INSERT #343 NULL (???) > > Notice that result #343 corresponds to the last PQsendQueryPrepared() > call made before the socket became readable (it's not always 343 but > around there). No luck reproducing any problems with this sequence as yet. -- Álvaro Herrera 39°49'30"S 73°17'W