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 1kL5tg-0006JV-4z for pgsql-admin@arkaria.postgresql.org; Wed, 23 Sep 2020 14:37:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kL5tc-0005sn-Qq for pgsql-admin@arkaria.postgresql.org; Wed, 23 Sep 2020 14:37:24 +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 1kL5tc-0005sf-FH for pgsql-admin@lists.postgresql.org; Wed, 23 Sep 2020 14:37:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kL5tX-0000Uh-7s for pgsql-admin@lists.postgresql.org; Wed, 23 Sep 2020 14:37:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 08NEbHuR1427100; Wed, 23 Sep 2020 10:37:18 -0400 From: Tom Lane To: jian xu cc: "pgsql-admin@lists.postgresql.org" Subject: Re: creating gist index on ltree column failed In-reply-to: References: Comments: In-reply-to jian xu message dated "Wed, 23 Sep 2020 13:31:27 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1427098.1600871837.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 23 Sep 2020 10:37:17 -0400 Message-ID: <1427099.1600871837@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk jian xu writes: > I tried to create gist index on a ltree column, first I got e= rror > ERROR: stack depth limit exceeded Hm. What PG version is this? If it's up-to-date, can you provide some sample data that causes such problems? > one thing I notice is, there are some rows with many levels(more than 1k= levels) in the ltree, if I delete those rows, creating gist index works I tried to reproduce this using just that information, but all I got was regression=3D# create table t (f1 ltree); CREATE TABLE regression=3D# create index on t using gist(f1); CREATE INDEX regression=3D# insert into t select ('0.' || (select string_agg(g::text,'.= ') from generate_series(1,100) g))::ltree; INSERT 0 1 regression=3D# insert into t select ('0.' || (select string_agg(g::text,'.= ') from generate_series(1,1000) g))::ltree; ERROR: index row requires 16048 bytes, maximum size is 8191 which is perhaps an annoying limitation, but it's not a bug. (I'm kind of wondering about the use-case for such long ltrees, anyway.) regards, tom lane