GET_VIEW_INDEXES¶
Description
The stored procedure GET_VIEW_INDEXES
returns a list of the indexes of views. These are the indexes that in the administration tool you see in the tab Indexes of the Options of the view.
Each row represents a field of an index.
Syntax
GET_VIEW_INDEXES (
input_database_name : text
, input_view_name : text
)
If you invoke the procedure using
CALL
and do not want to filter by a parameter, passnull
.If
input_database_name
andinput_view_name
arenull
, the procedure returns all the fields that are part of an index.If
input_view_name
isnull
, the procedure returns all the fields that are part of an index of theinput_database_name
.
The procedure returns these fields:
database_name
: name of database where the element belongs to.view_name
: name of the view.unique
: true if the field belongs to a unicity index; false otherwise.index_name
: name of the index.type
: type of the index.1
: this is a clustered index.2
: this is a hashed index.3
: this is some other style of index.
ordinal_position
: column sequence number within index. The first column is 1.column_name
: column name.asc_or_desc
: column sort sequenceA
: ascendingD
: descendingnull
: sort sequence is not supported
filter_condition
: filter condition ornull
if there is no filter condition.
Privileges Required
The results of this procedure change depending on the privileges granted to the user that runs it. If the user is not an administrator user, consider the following:
If the parameter
input_database_name
is notnull
, the procedure returns an error if the user does not have CONNECT privileges over this database.The procedure will only return information about the indexes of the views over which the user has
METADATA
privileges.
Example
SELECT unique, index_name, type
FROM get_view_indexes()
WHERE input_database_name ='chinook' AND input_view_name = 'album'
The result is:
index_name |
unique |
type |
---|---|---|
pk_index |
true |
3 |
IFK_AlbumArtistId |
false |
3 |