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 1mz3YW-0002Tv-EP for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Dec 2021 21:17:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mz3YV-0004aH-9V for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Dec 2021 21:17:19 +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 1mz3YV-0004a8-0v for pgsql-hackers@lists.postgresql.org; Sun, 19 Dec 2021 21:17:19 +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 1mz3YT-0003qy-1I for pgsql-hackers@lists.postgresql.org; Sun, 19 Dec 2021 21:17:17 +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 1BJLHGJU2209222; Sun, 19 Dec 2021 16:17:16 -0500 From: Tom Lane To: Justin Pryzby cc: pgsql-hackers@lists.postgresql.org Subject: Re: sqlsmith: ERROR: XX000: bogus varno: 2 In-reply-to: <20211219205422.GT17618@telsasoft.com> References: <20211219205422.GT17618@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Sun, 19 Dec 2021 14:54:22 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2209220.1639948636.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 19 Dec 2021 16:17:16 -0500 Message-ID: <2209221.1639948636@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Justin Pryzby writes: > I reduced the problematic query to this. > SELECT 1 FROM pg_rewrite WHERE > pg_get_function_arg_default(ev_class, 1) !~~ > pg_get_expr(ev_qual, ev_class, false); Or more simply, regression=3D# select pg_get_expr(ev_qual, ev_class, false) from pg_rewrit= e where rulename =3D 'pg_settings_u'; ERROR: bogus varno: 2 I don't see anything particularly surprising here. pg_get_expr is only able to cope with expression trees over a single relation, but ON UPDATE rules can refer to both OLD and NEW relations. Maybe we could make the error message more friendly, but there's not much else to be done, I think. regards, tom lane