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 1vVm3k-007Zwz-22 for pgsql-general@arkaria.postgresql.org; Wed, 17 Dec 2025 07:34:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVm3j-00B06V-0k for pgsql-general@arkaria.postgresql.org; Wed, 17 Dec 2025 07:34:56 +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 1vVm3i-00B06G-2y for pgsql-general@lists.postgresql.org; Wed, 17 Dec 2025 07:34:55 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vVm3i-0016gl-11 for pgsql-general@lists.postgresql.org; Wed, 17 Dec 2025 07:34:54 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-b7277324204so868559766b.0 for ; Tue, 16 Dec 2025 23:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1765956892; x=1766561692; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=abUGVNYB5ixumnvHvMgt2NIR0OQwR+ptoFPL58CZsyE=; b=kKaROd0LmdIFdzmZcfW9c2Du3PuoCbbQb2ACXy9GEK6r5hoIvIRorRVAsf7Orsdegh v0/mTS8gNuyLD8X00vSBBjNvi970G80aAMOkqZ4y5B+ZvHNyBi0mZgYH6n8JYcXRfqVD PZ+gYLkf/kOHlU47Z5kZkhp0NtW+LVQiK0xfhGMH/OKs0nKtoIVfZpRkDuK/xvHkMRj8 mDUlYsESO/yg9giBqMtlgYzezWiUoklTYJmY9Fc1hDMm+sZlf0nMxRuLDlNuACvNZmOY dX29dVne70FGSElCPdCHcrYbW5dIOsmkGvMgq5gqUD+cXmSPOFXfX0MrgxJb5IJpHi7+ sVyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765956892; x=1766561692; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=abUGVNYB5ixumnvHvMgt2NIR0OQwR+ptoFPL58CZsyE=; b=KN7Mr/VRojZiMw3BQks4HUfAmShUsjaSOWIGbPdRsEdvVcOxB0tzCL5lOM44b8Bj1P NEBYAx7tnMrOsO9c9qByq8wqyQfhGA96QHsGg9Wdk9vVZDqHVsQL1KpYsxGHxwt/KFJt r96OIndCmyMwGP4an7DNl7Z+7xfFr1yYrAEh5L1sz13PvON57fRR73ZP0fThoLw6LIsn Wdz+WJszbNDk+WLD0IGtJkdNdHfKfDqhQLWZb12efBH8SlCHFDcaw3U8j14eGexbnTki KtWA+Je+WJ6pmYGQkLvIUK7MenIUsD892S9uvo7jkQ7DLEzRdPX9dSLfQvOM4LR76ASY cYVw== X-Forwarded-Encrypted: i=1; AJvYcCWfTkfYdD7YHuE077+y8AXOAN3G9Q1coLR6hhZvZir2uSPQzl1EU/ez7l9kIF6yYjAbeESu9fJlFofjGPJi@lists.postgresql.org X-Gm-Message-State: AOJu0YwMY1jz8RVA6vvCSClJrdCpe11gzV93kbCh0vqeED1J3eYUCEsg i8J1o3QPqBiaEvy/cwT/6b7XR9wm7TLGEyZ6Br2BfovlyyPrAp3wetoVQ2j3EXmUPMXrwzIDXDL pvOcN X-Gm-Gg: AY/fxX6hFabKPv0a6gEv1m1EqZ1Z07WWl+r6SaYDrKv3yg9xWLRA+gjXa+9WiKhZIxL 67L7c8FDpA1BAJyM5hDdOIliWTCg+iW3ZTwmc0DjuZ5OGDPWdZOS33A3B+0ujITBPBBU6C07fDM mNeCS0akmYy8DYFu3+Hh0ZkUj4XwWeZnHNPOdCQ9kxCPK10k6n+bn+pFpcT2e67mNi8L2b0CcvN 7WHRHqj5xUJdhUlursR6nKDqut3KOkmdWttBl79jNKuTUCWvLILfC1bFiNSarR+maOJUfG15DW5 Z8jYRVmvKf1kkPsoOGJ7s9o5amXmyytIFnIynXuTqLFB2+V8/KAA/egQv7TPEfMk9F8ygdUJD6/ VjSlP3Q3BecSmykHAQN93woN0jQZWWHra4rkGilu9vxErjDLrXwskrPrploNaBWSkT4uy22OWk/ u8ABe1j9jsuznNa8xgAYjp4ZwtNc5RTEZTvxXitA== X-Google-Smtp-Source: AGHT+IEGIzW0f69B/NW8ytVzsrLDAViKKNqcVXG0Hhn4TYziHEtFV/deV3d1dFd2B1RXvs9c/51AyA== X-Received: by 2002:a17:907:6e90:b0:b73:6c97:af4b with SMTP id a640c23a62f3a-b7d23b69463mr1557844966b.45.1765956892467; Tue, 16 Dec 2025 23:34:52 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([41.66.98.235]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b3f4f5a22sm1703356a12.9.2025.12.16.23.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Dec 2025 23:34:52 -0800 (PST) Message-ID: Subject: Re: libpq simple SELECT From: Laurenz Albe To: Igor Korot , "pgsql-generallists.postgresql.org" Date: Wed, 17 Dec 2025 08:34:51 +0100 In-Reply-To: References: 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 Tue, 2025-12-16 at 21:49 -0800, Igor Korot wrote: > I just tried the following code: >=20 > [code] > std::wstring query1 =3D L"SELECT t.table_catalog AS catalog, > t.table_schema AS schema, t.table_name AS table, u.usename AS owner, > c.oid AS table_id FROM information_schema.tables t, > pg_catalog.pg_class c, pg_catalog.pg_user u WHERE t.table_name =3D > c.relname AND c.relowner =3D usesysid AND (t.table_type =3D 'BASE TABLE' > OR t.table_type =3D 'VIEW' OR t.table_type =3D 'LOCAL TEMPORARY') ORDER B= Y > table_name;"; > res =3D PQexec( m_db, m_pimpl->m_myconv.to_bytes( query1.c_str() > ).c_str() ); > for( int i =3D 0; i < PQntuples( res ); i++ ) > { > some code handling the results > } > [/code] >=20 > The loop is executed exactly 1 time. >=20 > My question is - according to the comment above I don't have to use curso= r, > but it looks like it's unavoidable? I see no cursor in your example... Yours, Laurenz Albe