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 1pQ9mv-0000Ax-SN for pgsql-general@arkaria.postgresql.org; Thu, 09 Feb 2023 16:28:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQ9mu-00068p-DI for pgsql-general@arkaria.postgresql.org; Thu, 09 Feb 2023 16:28:44 +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 1pQ9mt-00066k-MB for pgsql-general@lists.postgresql.org; Thu, 09 Feb 2023 16:28:43 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pQ9mr-0003yh-Fe for pgsql-general@lists.postgresql.org; Thu, 09 Feb 2023 16:28:42 +0000 Received: by mail-ej1-x62d.google.com with SMTP id ml19so8171708ejb.0 for ; Thu, 09 Feb 2023 08:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mSZOKb6Pc5NGODJ8q4jA5coqFQY39f1slFeHMahQpU8=; b=OWspPJ2ftD9g8ZIqWlo4ggd0IwS4mIbaJRK04ZPgeexeoqH7OMeZ/+PtpO8jPeK7Tq GnF34MzMPg42itjf8YBvlUaAVcFLqh8Xa52j1zx61EIGCE8dNWN/eUZA0MWR025iCFhz 7zdTRO46V/UMAXtZAZyP5sZxc0ZHpTMYI/2vXdkASfEYbng6S4xqkOrwlz/Pue80tIN/ u1FQOu2BKRI8TleANrXLFXv4GUsb3nQX8KGEtfulwxZRPMbq6stDe1tF0ioCa80c4iyQ aaTu/tZpJpZ2ZGTWueKBfgcrESP0oMpMpIXqqWlknH+AFy9d6XO2q4htORhOc0Bq0Xhq dFbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mSZOKb6Pc5NGODJ8q4jA5coqFQY39f1slFeHMahQpU8=; b=E3VVfIjdV/On0ygOSCVx7bRRBtsB2Al8s0YmM9ywLj3GW1Qmlu7yeHYJJ+eFhiSDoO KJADWEsMNNU7u75bkE08+w/cUcyOqS0E+19vsbFdeOT0DfbN/0wClkTOq1frHZKqwFLN xQITYNJTfB58rzZJTyBNMbXXAvYucwQ7QKwMKryae67i5HlRa0YAMYjaZrH3cqc0UoYg 2YKIbtDiTv7/rLTSd9eiU4dQ9qSPK1hgoHMNAjy8LlL//QUFsKscRkTJlWp1HK2PdLSf LF3TWhmLQUU1bHxJ75pCW23n8im434qZzUmjOqNJSQkXVGv/cO+9Qua9Xcbp1s67Tvjl wSyA== X-Gm-Message-State: AO0yUKXS5OQXnXNo4UMRNWytXuz9QSrGW2e9i3yFeikS7vm+0POL9VkC 0zcGvaV/OT7p7VXP9NE+zIQ= X-Google-Smtp-Source: AK7set88K94TJpPC4Voc99Ou5eT+tSr5AsZ2XOx2wDS6GUqoDKAev5ya79+4aAmq0jKYUnAgywnVOw== X-Received: by 2002:a17:906:6c97:b0:8ab:9657:3152 with SMTP id s23-20020a1709066c9700b008ab96573152mr8011967ejr.15.1675960120036; Thu, 09 Feb 2023 08:28:40 -0800 (PST) Received: from hollewijn.internal (217-19-30-105.dsl.cambrium.nl. [217.19.30.105]) by smtp.gmail.com with ESMTPSA id dt19-20020a170906b79300b0088ed7de4821sm1055007ejb.158.2023.02.09.08.28.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2023 08:28:39 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: WHERE col = ANY($1) extended to 2 or more columns? From: Alban Hertroys In-Reply-To: Date: Thu, 9 Feb 2023 17:28:37 +0100 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <024441B3-5505-42FB-A665-8DE93B54A1C7@gmail.com> References: To: Dominique Devienne X-Mailer: Apple Mail (2.3608.120.23.2.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 9 Feb 2023, at 16:41, Dominique Devienne = wrote: >=20 > Hi. We are implementing an API which takes a list of row keys, and = must return info about those rows. To implement that efficiently, in as = few round-trips as possible, we bind a (binary) array of keys (ints, = uuids, or strings) and that works great, but only if the key is a scalar = one. >=20 > Now we'd like to do the same for composite keys, and I don't know how = to do that. > Is it possible? Could someone please help out or demo such a thing? > We are doing it in C++ using libpq, but a pure SQL or PL/pgSQL demo = would still help (I think). This works: =3D> select (1, 'one'::text) in ((1, 'two'::text), (2, 'one'::text), (1, = 'one'::text), (2, 'two'::text)); ?column?=20 ---------- t (1 row) Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.