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 1mz3D2-0001bF-Dm for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Dec 2021 20:55:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mz3CU-00084d-BH for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Dec 2021 20:54:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mz3CT-00084T-Vh for pgsql-hackers@lists.postgresql.org; Sun, 19 Dec 2021 20:54:34 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mz3CL-0004ZR-K0 for pgsql-hackers@lists.postgresql.org; Sun, 19 Dec 2021 20:54:32 +0000 Received: by mail-io1-xd29.google.com with SMTP id e128so10871521iof.1 for ; Sun, 19 Dec 2021 12:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=pPARaI03+ecWrtz8BH8OzXCCtPzRW1aOaBGtddphTVs=; b=XayMS/Idgfwrd3z6SecdzGxoTTDJp77n5a5UcvN5az3O9oGU2P9J8ki+jLIayJtpD+ fbKWmRKdovaCzOSWJKwYPs/mLjDdTNJ1C8aL09IBHkOPo6TORigudVTzIl9XJEYl6CE+ NMn63Hqn/rI67ntV4CZdSo2d33pyl3Swr3+Z3RanuDV9Llk7rrfvTVgWiYVquh7nFKwb 2GWgea3obPafSleRStRPjho3Nl5074lLWs+uR2dcvldf0sLhF5vdJXgRIka1nakkTNrQ NOEbuJKbWttKK3EIETyRamcyizgPMk4VI62C5rOBwcgA8hlYf4cIhJdtYYeylbTZDgpj 09jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=pPARaI03+ecWrtz8BH8OzXCCtPzRW1aOaBGtddphTVs=; b=cpnBebv45c5v2btd8H5WJYTRvSxliV+8kOuIndIVkzM4ePKBGyzrzvTSYj8sYUVqKG Hsrm1ElYAggKTukrnw1+FH6NhftKYugZXJrNHNpvj4L6DkHweOZwEGTLrRrJiQA+ZzjO VC42D2mU/H205dsAtyfQQV8PBqcLBSxf63aKOXHAiCUll15toisOKOsK1ptk5Y99RJBo jMqQXJHa5Mbq7RnirDZFxVL/gZwHccK2r1NuGiO/NgCiGXTS3dPUM5t0cFBmmvRMAhW0 T3FFMy8EsHW95/yDQsuf2giDmV0uPbucj4RCZihdF5m/UEuwCxUuqem5Ip4RaMaVzWTm tQJg== X-Gm-Message-State: AOAM530taQ331gSdeOowzos6Cbzn2UHOtVWH7JWketWyJPy+CGl0sU2D GcsQXb4cg9Vmi+P/LyZwnQfpBh8+Abvp6Q== X-Google-Smtp-Source: ABdhPJwvsJoyB85r3NUIppaw8RDvUKdSCp8Yvy2zhzYt86ywnOlk4Ta2FT3/qDDdf6SVZZK650b+ng== X-Received: by 2002:a05:6638:3048:: with SMTP id u8mr7996402jak.207.1639947263798; Sun, 19 Dec 2021 12:54:23 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id l3sm145922ilh.12.2021.12.19.12.54.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Dec 2021 12:54:23 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 6212D800DF5; Sun, 19 Dec 2021 14:54:22 -0600 (CST) Date: Sun, 19 Dec 2021 14:54:22 -0600 From: Justin Pryzby To: pgsql-hackers@lists.postgresql.org Subject: sqlsmith: ERROR: XX000: bogus varno: 2 Message-ID: <20211219205422.GT17618@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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); #0 pg_re_throw () at elog.c:1800 #1 0x0000563f5d027932 in errfinish () at elog.c:593 #2 0x0000563f5cb874ee in resolve_special_varno (node=0x563f5dd0f7e0, context=0x7ffcf0daf250, callback=0x563f5cfca270 , callback_arg=0x0) at ruleutils.c:7319 #3 0x0000563f5cfca044 in get_variable () at ruleutils.c:7086 #4 0x0000563f5cfc7c58 in get_rule_expr () at ruleutils.c:8363 #5 0x0000563f5cfc97a6 in get_oper_expr (context=0x7ffcf0daf250, expr=0x563f5dd0f6f0) at ruleutils.c:9626 #6 get_rule_expr () at ruleutils.c:8472 #7 0x0000563f5cfcdc37 in deparse_expression_pretty (expr=expr@entry=0x563f5dd0f6f0, dpcontext=0x563f5dd10488, forceprefix=forceprefix@entry=false, showimplicit=showimplicit@entry=false, prettyFlags=prettyFlags@entry=2, startIndent=0) at ruleutils.c:3558 #8 0x0000563f5cfce661 in pg_get_expr_worker (expr=, relid=12104, relname=0x563f5dd10130 "pg_settings", prettyFlags=2) at ruleutils.c:2645 #9 0x0000563f5cd6540b in ExecInterpExpr () at execExprInterp.c:1272 #10 0x0000563f5cd73c5f in ExecEvalExprSwitchContext (isNull=0x7ffcf0daf3a7, econtext=0x563f5dd08a00, state=0x563f5dd0a270) at ../../../src/include/executor/executor.h:339 #11 ExecQual (econtext=0x563f5dd08a00, state=0x563f5dd0a270) at ../../../src/include/executor/executor.h:408 #12 ExecScan (node=0x563f5dd09328, accessMtd=0x563f5cd9e790 , recheckMtd=0x563f5cd9e780 ) at execScan.c:227 #13 0x0000563f5cd69f73 in ExecProcNode (node=0x563f5dd09328) at ../../../src/include/executor/executor.h:257 #14 ExecutePlan (execute_once=, dest=0x563f5dd18a80, direction=, numberTuples=0, sendTuples=, operation=CMD_SELECT, use_parallel_mode=, planstate=0x563f5dd09328, estate=0x563f5dd08790) at execMain.c:1600 #15 standard_ExecutorRun () at execMain.c:410 #16 0x0000563f5cf0460f in PortalRunSelect () at pquery.c:924 #17 0x0000563f5cf05bf1 in PortalRun () at pquery.c:768 #18 0x0000563f5cf019b2 in exec_simple_query () at postgres.c:1215 #19 0x0000563f5cf0370a in PostgresMain () at postgres.c:4498 #20 0x0000563f5ce6e479 in BackendRun (port=, port=) at postmaster.c:4594 #21 BackendStartup (port=) at postmaster.c:4322 #22 ServerLoop () at postmaster.c:1802 #23 0x0000563f5ce6f47c in PostmasterMain () at postmaster.c:1474 #24 0x0000563f5cb9a0c0 in main (argc=5, argv=0x563f5dc653f0) at main.c:198 While reducing the query, I got a related error: SELECT 1 FROM pg_rewrite WHERE pg_get_function_arg_default(ev_class, 1) !~~ pg_get_expr(ev_qual, 0, false); ERROR: XX000: bogus varlevelsup: 0 offset 0 LOCATION: get_variable, ruleutils.c:7003 Both errors are reproducible back to at least v10.