BUG #14220: pg_get_expr() with an incorrect relation id crashes the server
Chris Hanks <christopher.m.hanks@gmail.com>
From: christopher.m.hanks@gmail.com
To: pgsql-bugs@postgresql.org
Date: 2016-06-29T22:43:49Z
Lists: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 14220
Logged by: Chris Hanks
Email address: christopher.m.hanks@gmail.com
PostgreSQL version: 9.5.3
Operating system: Linux Mint 17.2 64-bit
Description:
SELECT version():
"PostgreSQL 9.5.3 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
4.8.2-19ubuntu1) 4.8.2, 64-bit"
Reproduction:
CREATE TABLE "test_table" ("id" serial PRIMARY KEY, "column_1" int4 NOT
NULL, "column_2" int4);
CREATE INDEX "idx" ON "test_table" ("column_1") WHERE ("column_2" = 4);
SELECT pg_get_expr(i.indpred, i.indexrelid) FROM pg_index i;
I realize that the query is incorrect, in order to retrieve the filter
expression as SQL I need to call pg_get_expr(i.indpred, i.indrelid). But it
seems like it should raise an error, rather than causing the server to
crash.