Perhaps the difference between us is that you believe that the behavior I
find advantageous should only be in a view, and not in an index. Perhaps
you feel that only a view should contain column selection and you feel
that an index should always select all columns, present and future.
Is there such a thing as a "keyed view"? I don't think so. There is no
"order by" clause that I can find in Create View.
http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/db2/rbafzhcview.htm?lang=en
I think that these special indexes that IBM allows to cover a majority of
the simple logical files in use are a hybrid of an index and a view.
Perhaps you need to study the RCDFMT clause on a CREATE INDEX. In there
you will see:
ADD ALL COLUMNS
ADD KEYS ONLY
ADD column name
The question then becomes: When I specify RCDFMT what is the default? I
believe it is ADD ALL COLUMNS. But, I believe it is ADD ALL COLUMNS as of
the time of the creation of the index, not "present and future".
There is no "ALTER INDEX" statement, let alone one with an ADD COLUMN
clause.
I think, currently, to get what you want you would need to DROP INDEX and
recreate it. There is no OR REPLACE option on CREATE INDEX. Therefore
you would need to get any security and other stuff like that handled on
your own.
I would not want to change the current default behavior because, well, it
works for us. And, if it works for us others may be counting on that
behavior as well.
If you want to submit a DCR to IBM to add some sort of function you're
welcome to do so. You'll get much farther if you can find this behavior
documented in the SQL standards.
You might have an easier time asking for the addition of the OR REPLACE on
create index. Baby steps?
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.