Re: [PATCH] Cleanup: use heap_open/heap_close consistently
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Marti Raudsepp <marti@juffo.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2012-02-27T16:59:12Z
Lists: 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