Re: Getting ERROR: bogus varno: 2 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Getting ERROR: bogus varno: 2
Date
Msg-id 10124.1552412587@sss.pgh.pa.us
Whole thread Raw
In response to Getting ERROR: bogus varno: 2  (Neel Patel <neel.patel@enterprisedb.com>)
Responses Re: Getting ERROR: bogus varno: 2
List pgsql-hackers
Neel Patel <neel.patel@enterprisedb.com> writes:
> Getting "*ERROR:  bogus varno: 2*" and below is the sample SQL.

Hmm, reproduced here on HEAD.

> Is this error message expected or what should be the behaviour ?

It's certainly a bug.  Don't know the cause yet, but it looks like
pg_get_expr() is getting confused:

#0  errfinish (dummy=0) at elog.c:411
#1  0x00000000008aea4f in elog_finish (elevel=<value optimized out>, 
    fmt=0xaa30e3 "bogus varno: %d") at elog.c:1365
#2  0x000000000084d761 in resolve_special_varno (node=0x2e70598, 
    context=0x7ffc79094e80, private=0x0, 
    callback=0x852b90 <get_special_variable>) at ruleutils.c:6862
#3  0x00000000008529d5 in get_variable (var=0x2e70598, 
    levelsup=<value optimized out>, istoplevel=false, context=0x7ffc79094e80)
    at ruleutils.c:6652
#4  0x0000000000850c21 in get_rule_expr (node=0x2e70598, 
    context=0x7ffc79094e80, showimplicit=true) at ruleutils.c:7812
#5  0x00000000008521ba in get_oper_expr (node=0x2e70488, 
    context=0x7ffc79094e80, showimplicit=<value optimized out>)
    at ruleutils.c:9076
#6  get_rule_expr (node=0x2e70488, context=0x7ffc79094e80, 
    showimplicit=<value optimized out>) at ruleutils.c:7921
#7  0x0000000000858a0d in deparse_expression_pretty (expr=0x2e70488, 
    dpcontext=0x2e70be8, forceprefix=<value optimized out>, 
    showimplicit=false, prettyFlags=2, startIndent=0) at ruleutils.c:3202
#8  0x000000000085a682 in pg_get_expr_worker (expr=<value optimized out>, 
    relid=33887, relname=0x2e70248 "test_bogus", prettyFlags=2)
    at ruleutils.c:2393


            regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Use nanosleep(2) in pg_usleep, if available?
Next
From: Tom Lane
Date:
Subject: Re: Getting ERROR: bogus varno: 2