Fix incorrect join condition. We want to join all columns of the inde… #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…x, no matter the column order in the table
The query selects the average length for all columns in the index. At the moment the columns from the index are selected as
regexp_split_to_table(indkey::text, ' ')::smallint
, which provides the column numbers from the columns with respect to the table. For example column 10 and column 11.When joining with the table
pg_attribute
this gives a problem since this table contains the column numbers with respect to the order within the index. For a index on two columns this would be 1 and 2. Since the orders in the two tables differs, we can't use this as a join condition.Since we want to select the average columns width for all columns in the index we can just join all the columns from
pg_attribute
.