Re: [PATCH] Cleanup: use heap_open/heap_close consistently - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Cleanup: use heap_open/heap_close consistently
Date
Msg-id 15090.1330361952@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Cleanup: use heap_open/heap_close consistently  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [PATCH] Cleanup: use heap_open/heap_close consistently  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.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


pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: overriding current_timestamp
Next
From: Tom Lane
Date:
Subject: Re: pgstat documentation tables