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.96) (envelope-from ) id 1vVz6R-00AIwi-0U for pgsql-general@arkaria.postgresql.org; Wed, 17 Dec 2025 21:30:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVz6Q-00GgkL-07 for pgsql-general@arkaria.postgresql.org; Wed, 17 Dec 2025 21:30:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVz6P-00GgkC-2A for pgsql-general@lists.postgresql.org; Wed, 17 Dec 2025 21:30:34 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vVz6O-001DU5-2f for pgsql-general@lists.postgresql.org; Wed, 17 Dec 2025 21:30:33 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-477770019e4so58116355e9.3 for ; Wed, 17 Dec 2025 13:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1766007031; x=1766611831; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=TZmv3lgn62c/UTlVodpcW0y3pfCCnaXzwXoMJrAwnYM=; b=JR+JYE79KRBYVNpXIy1B2irswPArjJGj9BvHnTv5/V7vzjyTBNLiq7pBmatKA59S7X fi9aRDw9kSxVjeR6ghmLodrirGx0wDMhkwkWB+nOazeX8cDR+fz9LT87PXYF4CB10USF buZxgBQHeWeFI/5HZpjYpJJAOzcG92s0mWydkFbtAgws2SC0CQNiZJX94m758FehONw+ ZZ8k6e5aJzy5hX6A4O/L49yAvNTSYJXbImmkElBP49ttISAxvSJiH81u+oMpHtfbnENu YdcJLevQaVapmOTyHjdRXNHQO4hP1VRMaArSNHkTAmpvamyLl6L7XgfHixzj2CkKg6LN yoMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766007031; x=1766611831; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TZmv3lgn62c/UTlVodpcW0y3pfCCnaXzwXoMJrAwnYM=; b=CuSPubDODHLZIOflU2kzZa23T6eKsj0NEJ/ouqKMLRUw8HMlqugPfWKJzdIi4AD4Q2 dqy/HG+q4ythePeQcbW5JD/VEGNOkJ4DWAIMYDFgB3lFVgpK3Ja8nxg9YZ7yBVaS6aeB sPLYIaWVQmd33H6w3Urdn3U9cgf6FqYmnuooFnLLDtEsc62oLJPz1gORbax4UmkhUZx3 0CDpMddhs5tXCNFIgd5dFRC5C1O/eqzcjf5mEChF89/yazbuPSJlizQdVAbzEEkXxV0m KEzw83XTm128QzeexoC3FKv0O0u4v0sCKSGTrBk4DpWZwjC9ynYDkc8BVzrw2n6oBvET nqtw== X-Gm-Message-State: AOJu0Yznchha1hwORBE5gBjR8yESW/zDqBXpmTtaQ75E7/ZqgMEulzuL Q6Fz/QNAJYjtGN3+0h8J0R22e96HFeBJjIiIcj8KN+CbAYS8cg93QU1Igu2msUctvMA= X-Gm-Gg: AY/fxX6Dnx0wHRg79pPTVZv9nU2bZCvl/5IDDpWAGdl9dhy3X43xr3oQHk0nsJUstnM 5zeVc1FiEAxgnF5NXd3qX29KQG9dgHYV6uPLJulX+HpfBoyP/7RF7Qb0jqCRyeFkrK1KcabeRkw MVY6moxOMUE80z5r3MLIhRcaY1NBh3c7P9duMZnpkswUOeyFjmsEK1eoM+cHTYDpWt20LL1Daxb N+m+jjjb1dwIgnOH1ULKfeM6pdASgq77Zqp/MboNBqacrZaYw6tK95/HNmOLR4NMOdovN4etiTH x6AN6ypn18CQxoxyluGhc4aQaewmuIUzRA++geSEphBlwqVF+nWogFu2510tYqExTkKZtflMYdt boFJIMMpGOnC2P4FAVOi+Tqyi8b7R5gAk06F2Kyu24M6B304xks8CKxo3fuR6SIOca8GvrIamyb U/s7GrmEn2zM4DqbzyCq7Sf3/UwdhFwD+PW/5p9A0Qjw8= X-Google-Smtp-Source: AGHT+IHBNwAz4KAliD1C6k6uYx2gm3o1zADhHeaedWvNBapVd6WeX6wL/qKkw+z10sdbWNuC+M5OOw== X-Received: by 2002:a05:600c:83c6:b0:47b:da85:b9ea with SMTP id 5b1f17b1804b1-47bda85bc4bmr70613665e9.18.1766007030754; Wed, 17 Dec 2025 13:30:30 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:270:4cf9:1875:33eb:6694:f468]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43244999336sm1041386f8f.36.2025.12.17.13.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 13:30:30 -0800 (PST) Message-ID: <319efe7106d8db21e3bfa0fdb60fa37aa59d331c.camel@cybertec.at> Subject: Re: libpq simple SELECT From: Laurenz Albe To: Igor Korot Cc: "pgsql-generallists.postgresql.org" Date: Wed, 17 Dec 2025 22:30:29 +0100 In-Reply-To: References: <3fd9c2859c323d6f894ccf660764f24dc3423181.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2025-12-17 at 13:07 -0800, Igor Korot wrote: > This is a comment: >=20 > /* > =C2=A0=C2=A0=C2=A0=C2=A0 * Our test case here involves using a cursor, fo= r which we must be inside > =C2=A0=C2=A0=C2=A0=C2=A0 * a transaction block.=C2=A0 We could do the who= le thing with a single > =C2=A0=C2=A0=C2=A0=C2=A0 * PQexec() of "select * from pg_database", but t= hat's too trivial to make > =C2=A0=C2=A0=C2=A0=C2=A0 * a good example. > =C2=A0=C2=A0=C2=A0=C2=A0 */ >=20 > When I read it my understanding is: >=20 > It is possible to write the code without a cursor.. > However it will be trivial and so the code will use CURSOR. > But the usage of CURSOR is actually not required - it is used > in the docs only to make a good example. >=20 > However, when I tried to write the code without the CURSOR > it seems that CURSOR usage is a must and not optional, which > contradicts the comment above. >=20 > I hope now my question is clear. I want to know if using CURSR > is a must. Sorry that it took me so long to understand what you mean. Your PQexec call should return all rows. If you don't get all rows, there must be some other problem with your code. You didn't show enough of the code for me to see where the problem is. Yours, Laurenz Albe