pgsql: Ensure an index that uses a whole-row Var still depends on its t

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Ensure an index that uses a whole-row Var still depends on its t
Date: 2010-11-02 21:16:13
Message-ID: E1PDODF-0001wc-Ha@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Ensure an index that uses a whole-row Var still depends on its table.

We failed to record any dependency on the underlying table for an index
declared like "create index i on t (foo(t.*))". This would create trouble
if the table were dropped without previously dropping the index. To fix,
simplify some overly-cute code in index_create(), accepting the possibility
that sometimes the whole-table dependency will be redundant. Also document
this hazard in dependency.c. Per report from Kevin Grittner.

In passing, prevent a core dump in pg_get_indexdef() if the index's table
can't be found. I came across this while experimenting with Kevin's
example. Not sure it's a real issue when the catalogs aren't corrupt, but
might as well be cautious.

Back-patch to all supported versions.

Branch
------
REL8_3_STABLE

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=34f89342e551ed58dbbfcb3fd9000aed047d3a1e

Modified Files
--------------
src/backend/catalog/dependency.c | 15 ++++++++++++++-
src/backend/catalog/index.c | 15 +++++----------
src/backend/utils/adt/ruleutils.c | 24 +++++++++++++++++++++---
3 files changed, 40 insertions(+), 14 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-11-02 21:32:19 pgsql: Fix buffer overrun in pg_upgrade.
Previous Message Michael Meskes 2010-11-02 17:14:53 pgsql: Some cleanup in ecpg code: