Re: Getting ERROR: bogus varno: 2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neel Patel <neel(dot)patel(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Getting ERROR: bogus varno: 2
Date: 2019-03-12 17:43:07
Message-ID: 10124.1552412587@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neel Patel <neel(dot)patel(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-03-12 17:57:19 Re: Getting ERROR: bogus varno: 2
Previous Message Tom Lane 2019-03-12 17:36:21 Re: Use nanosleep(2) in pg_usleep, if available?