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 1srD2D-00G6nu-43 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Sep 2024 09:01:09 +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 1srD1D-007Rj0-KH for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Sep 2024 09:00:07 +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 1srD1D-007RfY-7N for pgsql-hackers@lists.postgresql.org; Thu, 19 Sep 2024 09:00:07 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1srD1B-001yFc-0x for pgsql-hackers@lists.postgresql.org; Thu, 19 Sep 2024 09:00:06 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2f74e613a10so8086241fa.1 for ; Thu, 19 Sep 2024 02:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726736403; x=1727341203; darn=lists.postgresql.org; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=8MuCDZxIwGV2XeWqhRyOuzdttsDXZlhf1frcyMzkhX4=; b=GeQnQ3OILZcHm7+sls3dTtFPHYgBXxKO/AUvMgccK2rkZZM/E36weGD6Y51fXEgIUK Av9pac30Om6C83+tpMPuc0rY11wKdQ8KluIaek9nSLVzwdVCaz8kmoLly/XPtRGPiZVi 6UERblwEGA0Xl++SObiz2ISmaC/w/omhLDJEvEWIUPsdCndLLgqSdJRSmqj2j7Ff0Qsy Hc/0B4XNJ4l/SYolsU7i7HBaRqwg/n7XHRyMsMa1zt+tzPZ57xLoWbyTk0UlEn2vyuYV 7zKm4Dg8vJtYGTwCgI3UhZjOIyXqPvve8gpWy9CIUQJJ9xhbvoYf2Cs/TriNFoxdqeJQ DejA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726736403; x=1727341203; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=8MuCDZxIwGV2XeWqhRyOuzdttsDXZlhf1frcyMzkhX4=; b=TxzwxtN++DVjYLTkSeQKPrTH1EYyM4GPYvDiYQNtt/jI/nbNnzcdrlr6PF0N4EkRwj mgRTkZTR+EAeyGN35jexHOeM22JoJrh3479Z3hDls3alEf2pqaQjfEZtSfU7DLyCQBwp 7hX/0d1oi3IuqJWD/GhKf/8hoXy3ZocQrVhKnw00TMQWs4rXXqa3E7qpU6JGxIFNWA5Q S4DeSy5ofTSiz3n7oJuvZetJ2vss16uSXfS9zFE6i/Y/8O89X5JX7c+cj+qekApFGwVe dincKU18kWNdjEwjvqbr+lhJQSQkHegmsnvGIH7ABhiQqsBxC88c7rGcN2W0E0DOKRs1 XtKQ== X-Forwarded-Encrypted: i=1; AJvYcCUTb5Un+AOCXsP6mK3r7jh9gF5lGaH5frGpAToHT5IBVhbW3qDBfgYvzrJq2HSAD0/l9shaQPnSVQZql6+/@lists.postgresql.org X-Gm-Message-State: AOJu0YwGZ9x2G0FBuiENnQUS5YEEFdwLza8A8CYhzRinf//XUHMwoack psWcAW5a+KMRJY46qFefQwN14a9tqJU5PRaLMpN3mrDAo65jbeq4 X-Google-Smtp-Source: AGHT+IEAKhVhdGwckf1utjii3CvZGc+o7zdbuEFA21Xk7enllaIczxfkuvyojOKWgYGLjRQ6p32KUA== X-Received: by 2002:a2e:4e02:0:b0:2ef:2555:e52d with SMTP id 38308e7fff4ca-2f791b66d4cmr95818561fa.45.1726736402449; Thu, 19 Sep 2024 02:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.24.71]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f79d3012e4sm16076451fa.39.2024.09.19.02.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Sep 2024 02:00:01 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------BMr5CRBA0z939SKJl0c7KbKO" Message-ID: Date: Thu, 19 Sep 2024 12:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Large expressions in indexes can't be stored (non-TOASTable) Content-Language: en-US To: Nathan Bossart , Tom Lane Cc: "Jonathan S. Katz" , PostgreSQL Hackers References: <1679756.1725476893@sss.pgh.pa.us> <1812111.1726671296@sss.pgh.pa.us> From: Alexander Lakhin In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------BMr5CRBA0z939SKJl0c7KbKO Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello Nathan, 18.09.2024 22:52, Nathan Bossart wrote: > Committed. I waffled on whether to add a test for system indexes that used > pg_index's varlena columns, but I ended up leaving it out. I've attached > it here in case anyone thinks we should add it. I've discovered that Jonathan's initial script: CREATE TABLE def (id int); SELECT array_agg(n) b FROM generate_series(1,10_000) n \gset CREATE OR REPLACE FUNCTION vec_quantizer (a int, b int[]) RETURNS bool AS $$ SELECT true $$ LANGUAGE SQL IMMUTABLE; CREATE INDEX ON def (vec_quantizer(id, :'b')); completed with: DROP INDEX CONCURRENTLY def_vec_quantizer_idx; triggers an assertion failure: TRAP: failed Assert("HaveRegisteredOrActiveSnapshot()"), File: "toast_internals.c", Line: 668, PID: 3723372 with the following stack trace: ExceptionalCondition at assert.c:52:13 init_toast_snapshot at toast_internals.c:670:2 toast_delete_datum at toast_internals.c:429:60 toast_tuple_cleanup at toast_helper.c:303:30 heap_toast_insert_or_update at heaptoast.c:335:9 heap_update at heapam.c:3752:14 simple_heap_update at heapam.c:4210:11 CatalogTupleUpdate at indexing.c:324:2 index_set_state_flags at index.c:3522:2 index_concurrently_set_dead at index.c:1848:2 index_drop at index.c:2286:3 doDeletion at dependency.c:1362:5 deleteOneObject at dependency.c:1279:12 deleteObjectsInList at dependency.c:229:3 performMultipleDeletions at dependency.c:393:2 RemoveRelations at tablecmds.c:1594:2 ExecDropStmt at utility.c:2008:4 ... This class of assert failures is not new, see e. g., bugs #13809, #18127, but this concrete instance (with index_set_state_flags()) emerged with b52c4fc3c and may be worth fixing while on it... Best regards, Alexander --------------BMr5CRBA0z939SKJl0c7KbKO Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
Hello Nathan,

18.09.2024 22:52, Nathan Bossart wrote:
Committed.  I waffled on whether to add a test for system indexes that used
pg_index's varlena columns, but I ended up leaving it out.  I've attached
it here in case anyone thinks we should add it.

I've discovered that Jonathan's initial script:
CREATE TABLE def (id int);
SELECT array_agg(n) b FROM generate_series(1,10_000) n \gset
CREATE OR REPLACE FUNCTION vec_quantizer (a int, b int[]) RETURNS bool
AS $$ SELECT true $$ LANGUAGE SQL IMMUTABLE;
CREATE INDEX ON def (vec_quantizer(id, :'b'));

completed with:
DROP INDEX CONCURRENTLY def_vec_quantizer_idx;

triggers an assertion failure:
TRAP: failed Assert("HaveRegisteredOrActiveSnapshot()"), File: "toast_internals.c", Line: 668, PID: 3723372

with the following stack trace:
ExceptionalCondition at assert.c:52:13
init_toast_snapshot at toast_internals.c:670:2
toast_delete_datum at toast_internals.c:429:60
toast_tuple_cleanup at toast_helper.c:303:30
heap_toast_insert_or_update at heaptoast.c:335:9
heap_update at heapam.c:3752:14
simple_heap_update at heapam.c:4210:11
CatalogTupleUpdate at indexing.c:324:2
index_set_state_flags at index.c:3522:2
index_concurrently_set_dead at index.c:1848:2
index_drop at index.c:2286:3
doDeletion at dependency.c:1362:5
deleteOneObject at dependency.c:1279:12
deleteObjectsInList at dependency.c:229:3
performMultipleDeletions at dependency.c:393:2
RemoveRelations at tablecmds.c:1594:2
ExecDropStmt at utility.c:2008:4
...

This class of assert failures is not new, see e. g., bugs #13809, #18127,
but this concrete instance (with index_set_state_flags()) emerged with
b52c4fc3c and may be worth fixing while on it...

Best regards,
Alexander
--------------BMr5CRBA0z939SKJl0c7KbKO--