Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPIrJ-00Ad6e-Tt for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Jan 2024 09:02:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rPIrI-00ELOv-L3 for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Jan 2024 09:02:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPIrI-00ELOn-Aw for pgsql-hackers@lists.postgresql.org; Mon, 15 Jan 2024 09:02:16 +0000 Received: from mail-yb1-f170.google.com ([209.85.219.170]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rPIrF-001ty1-2p for pgsql-hackers@postgresql.org; Mon, 15 Jan 2024 09:02:15 +0000 Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-dbed7c0741fso7354308276.2 for ; Mon, 15 Jan 2024 01:02:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705309331; x=1705914131; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2wC4fM941dl+0E49lyOFlHNr1xZkUuvPoNNQGTyFtS4=; b=ox9S+8DQXQkL1sjlF4tso+RBjOlPsFwFEiUD1ggP0QSqJtNegGvRTYspJDtMua6cWz lbaIUHCElaupvL8QiZM+z/gWDpWxTkzBpveLteOctoMZpzTT9Wb1LHsAoqw3iid3Clz/ wvXhQY8GW6KxNdkPiyzRKYg8HiMFaPbwPJwZuTMJsK9HAwSw91dFTXLWNtk7bKAbffaV bk5o38kBTRjOtybE8fUPotbXai6wRo27ZRbPkxGEcpeaVMkCuDJgV56Qx2khTdFWpci9 op5UZp5UctSwT/UyyMLktKYR6PrZD2X9mvmKWFFXzZcLAN0m6ed7O+4d1wUYTMiC0GNc gdCQ== X-Gm-Message-State: AOJu0Yym+fuOmJUAKbvvblx+U9EE0yFXiWNuAXvAMnpY6cjb0g1TobKK 5+Qtaszfv/ZEmNOAE+ejQUlVwQhfFXWiJgE+jjFBhc5E0wAEEw== X-Google-Smtp-Source: AGHT+IHklHpzFQDT+gAsuYEySrZs/WyNJ1AbtIFQ2c3sYqCJFV579sbwlJFSZZOVlVSkNCyTKz5DcDC3YXzzwxMQGGU= X-Received: by 2002:a05:6902:2210:b0:dbe:4f15:b5c6 with SMTP id dm16-20020a056902221000b00dbe4f15b5c6mr3199681ybb.119.1705309330817; Mon, 15 Jan 2024 01:02:10 -0800 (PST) MIME-Version: 1.0 References: <202311081620.s2a7ao5jtlpe@alvherre.pgsql> In-Reply-To: From: Jelte Fennema-Nio Date: Mon, 15 Jan 2024 10:01:59 +0100 Message-ID: Subject: Re: Add PQsendSyncMessage() to libpq To: Michael Paquier Cc: Anthonin Bonnefoy , Anton Kirilov , Alvaro Herrera , Robert Haas , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 15 Jan 2024 at 08:50, Michael Paquier wrote: > Yeah, I'll go with that after a second look. Attached is what I am > finishing with, and I have reproduced some numbers with the pgbench > metacommand mentioned upthread, which is reeeaaally nice. Code looks good to me. But one small notes on the test. + /* second pipeline */ + if (PQsendQueryParams(conn, "SELECT $1", 1, dummy_param_oids, + dummy_params, NULL, NULL, 0) != 1) + pg_fatal("dispatching first SELECT failed: %s", PQerrorMessage(conn)); Error message should be "second SELECT" not "first SELECT". Same note for the error message in the third pipeline, where it still says "second SELECT". + res = PQgetResult(conn); + if (res == NULL) + pg_fatal("PQgetResult returned null when there's a pipeline item: %s", + PQerrorMessage(conn)); + + if (PQresultStatus(res) != PGRES_TUPLES_OK) + pg_fatal("Unexpected result code %s from first pipeline item", + PQresStatus(PQresultStatus(res))); + PQclear(res); + res = NULL; + + if (PQgetResult(conn) != NULL) + pg_fatal("PQgetResult returned something extra after first result"); same issue: s/first/second/g (and s/second/third/g for the existing part of the test).