Re: BUG #14220: pg_get_expr() with an incorrect relation id crashes the server

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, christopher(dot)m(dot)hanks(at)gmail(dot)com, PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14220: pg_get_expr() with an incorrect relation id crashes the server
Date: 2016-07-01 14:32:33
Message-ID: 18868.1467383553@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> I have poked at this bug report yesterday and today, and found that it
> is as well possible to hit the second assertion two lines below with a
> dropped column. So I would like to propose the patch attached to
> replace both assertions with an elog(ERROR).

There's a quite similar error check just a few lines above that prints

elog(ERROR, "bogus varattno for subquery var: %d", var->varattno);

I'm not necessarily wedded to that exact phrasing, but I think these new
error messages should be consistent with that one. I'm a bit inclined
to make all three of them read like

elog(ERROR, "invalid attnum %d for table \"%s\"",
attnum, rte->eref->aliasname);

> Test cases are included,
> though I am not sure if they bring much value.

Yeah, I can't get very excited about memorializing those.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2016-07-01 14:50:55 Re: BUG #14221: using postgresql 9.1.22 to 9.3.13 failed using pg_upgrade
Previous Message pange.akshaya 2016-07-01 12:54:21 BUG #14222: psqlODBC driver connection pooling not working for .net codebase