Re: [PATCH] Cleanup: use heap_open/heap_close consistently

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Marti Raudsepp <marti(at)juffo(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Cleanup: use heap_open/heap_close consistently
Date: 2012-02-27 16:59:12
Message-ID: 15090.1330361952@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> I'm almost inclined to think that
> we should be trying to get rid of heap_open() altogether; there are
> already plenty of places that assume that opening the relation is as
> good as opening the heap, so I don't think there'd be any real loss of
> abstraction.

Or, perhaps, restrict it to open actual heaps (ie, relkind 'r')?

I think that if you count, you'll find the vast majority of heap_open
calls are really opening system catalogs. So I'd just as soon have
a relkind check there for sanity's sake, not to mention that renaming
them all creates a lot of unnecessary code churn.

IMO it would be sensible for heap_open to insist on a heap, index_open
to insist on an index, and for anything else, use relation_open and
BYO relkind check. There are a few common patterns (eg "does relation
have storage") that we should abstract somehow, but it might be better
to provide separate relkind-check routines than to invent xxx_open.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-02-27 17:00:44 Re: pgstat documentation tables
Previous Message David E. Wheeler 2012-02-27 16:51:20 Re: overriding current_timestamp