Обсуждение: Bizarre reindex_relation API

Поиск
Список
Период
Сортировка

Bizarre reindex_relation API

От
Tom Lane
Дата:
Why in the world is reindex_relation defined like this?

#define REINDEX_CHECK_CONSTRAINTS    0x1
#define REINDEX_SUPPRESS_INDEX_USE    0x2
extern bool reindex_relation(Oid relid, bool toast_too, int flags);

Seems like a rational design would have folded toast_too in as another
flag bit, instead of keeping it a separate argument.
        regards, tom lane


Re: Bizarre reindex_relation API

От
Noah Misch
Дата:
On Sat, Apr 16, 2011 at 11:52:47AM -0400, Tom Lane wrote:
> Why in the world is reindex_relation defined like this?
> 
> #define REINDEX_CHECK_CONSTRAINTS    0x1
> #define REINDEX_SUPPRESS_INDEX_USE    0x2
> extern bool reindex_relation(Oid relid, bool toast_too, int flags);
> 
> Seems like a rational design would have folded toast_too in as another
> flag bit, instead of keeping it a separate argument.

`relid' and `toast_to' constitute the direct object, and `flags' are adverbs.
(Not sure if just made that up or actually rationalized it that way at the
time.)  No objection to changing it.


Re: Bizarre reindex_relation API

От
Robert Haas
Дата:
On Apr 16, 2011, at 11:52 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Why in the world is reindex_relation defined like this?
>
> #define REINDEX_CHECK_CONSTRAINTS    0x1
> #define REINDEX_SUPPRESS_INDEX_USE    0x2
> extern bool reindex_relation(Oid relid, bool toast_too, int flags);
>
> Seems like a rational design would have folded toast_too in as another
> flag bit, instead of keeping it a separate argument.

I thought about that for roughly three minutes, decided there was something awkward about it that I no longer recall,
andit go. I don't object if you want to rejigger it. 

...Robert