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 1vLcbx-005I0Y-1N for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Nov 2025 07:28:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vLcbv-00BBwc-2W for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Nov 2025 07:28: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.96) (envelope-from ) id 1vLcbv-00BBwT-1X for pgsql-hackers@lists.postgresql.org; Wed, 19 Nov 2025 07:28:15 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vLcbu-000Jse-08 for pgsql-hackers@postgresql.org; Wed, 19 Nov 2025 07:28:15 +0000 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-b98983bae80so4789449a12.0 for ; Tue, 18 Nov 2025 23:28:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763537291; x=1764142091; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Pw1tgNh+iGuvw89FPbs1LPgYDKr2TZ/PQIcJ7beGBoE=; b=fh6fsQLM3YdjiOvmDyM2tlxRzYrjLcoLcE5C6mVWsGLu8pIS3IEzVlqWMGDSNrM2YC vS96PSKciKld9JncG9wDYcUInceU5Nv6oq1qJ+kfsN2cAy6UbCm057uW8MJis+vbmoC9 HL8Nq6ld02x1Uu2tr/mmVLx0UwiC0P7loJIPtMo01b2x5djTMN4yy+FOfYHCuWujZF33 RDRM+gpoRQaSEXom44JWaJ9Rl6IaNGvMaMZH6V+5fbVQqodlFJ2/0AlPHfPIRfmnA1zV DK2zAYEva4ezgXxq561DcUuUiT37ycj3RNm9gzT6Z5EJaPbdoGC8W5E3/lhYJ3coZz1Z bmjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763537291; x=1764142091; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Pw1tgNh+iGuvw89FPbs1LPgYDKr2TZ/PQIcJ7beGBoE=; b=A1cJimTpIBL+6faFZrIj+fjBLO/sIaBLz5219g28uCZPOkEvdnuuP0f2xvECqqyLS2 Rg7iYqxpTRDoTmwFxDaOuZTTGTHnGWN8Etigpr6mo98yYgXM6ZW57SUI0utbi/A3TcvR KBYSza59BC83ceMc8rIlq2ZrV7ucao/IsSWTQdrdkUlQAtjsIkoTa/5vqSDBARS0RS4J WNx2s1StW4czZv23BR02d7Wxan3XGzopDjYDlFRqS/RdoWfrG2SkKS+NwNkD6tx2XagA C4koVRwKLNNfqvv9W7R50nD4lw2L7m3O6VcDYreAbay4qKNswez+UJhb9pGSm0gHnYDE iYiA== X-Forwarded-Encrypted: i=1; AJvYcCXN7gd+2i5p0kToquR4Ysz0HNwEXvTFMDLdvxhWY8Mgjwgr56OZUmvZ76/pB+BDU7ItgavFx03tdPrXGuh9@postgresql.org X-Gm-Message-State: AOJu0Yz45FaQn8jLlu4ShlVhCQYbCz0UQlI/e0bmBtxv5JnC4S0z1EMq fAt9JaKYEVosYN6eNhHiLwrGrFbJ2RS2x4ICKF3k7cfQ5vq4fT8aG1N5c5l4amEdLE9gFw3Wvw6 tX5pWscpARsU+ru/IsIEQuMybnnD+MRA= X-Gm-Gg: ASbGncuRYcKyLVfeTpoSlqpmmoiIbOShq/jCMYs/JvVF0HiXwAokSPijPmsPuluaPRy ItPMRim275N+HplxGvteMvMiy/Q0oF0R0T7cAyNmxpy3tE+Z9A2/aUTZFrnRYbejPusrTTfY/0g ReVdqmK9oNNR7EMLnVeVRu//bLcGpvReRI0VYo3+7oqesRhnEuMi9BiNoSv7ZoUK8Jz66Y+NWVJ /y4IdiDrBI9KUCV/dIr2thFft5QyoZ3XBDefC5X9g32TtJIDgiw+xuSGOwuC/HatTFqvw== X-Google-Smtp-Source: AGHT+IHg0acDc9SGyzTRTBMeci2hqh+DLj2VsApNVhP7/roWT/b74ryNb6E2M2kV9ioRdOqD3lbo28K+Evusk4ZVKJA= X-Received: by 2002:a05:7300:d0ae:b0:2a4:7671:db3d with SMTP id 5a478bee46e88-2a4ab873d8bmr5886665eec.3.1763537290694; Tue, 18 Nov 2025 23:28:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Nazir Bilal Yavuz Date: Wed, 19 Nov 2025 10:27:59 +0300 X-Gm-Features: AWmQ_bkVy_ADTMCfC0pjnyusMk0l_Le_m0CrpOWQicBbVnnF2-_dpalTwsjzvFo Message-ID: Subject: Re: Trying out read streams in pgvector (an extension) To: Melanie Plageman Cc: Thomas Munro , "Jonathan S. Katz" , pgsql-hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Wed, 19 Nov 2025 at 00:17, Melanie Plageman wrote: > > To make sure 1) distance isn't reset to a resume_distance from > read_stream_begin_relation() and 2) unexpected buffers aren't returned > from the read stream, we could error out in read_stream_resume() if > pinned_buffers > 0. And in read_stream_reset(), we would save distance > in resume_distance before clearing distance. That would allow calling > read_stream_resume() either if you called read_stream_reset() or if > you exhausted the stream yourself. See rough attached patch for a > sketch of this. This looks correct to me. What do you think about using an assert instead of erroring out? -- Regards, Nazir Bilal Yavuz Microsoft