You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there is a partial index and also tablespace then the query formed adds TABLESPACE clause to the end like below:
e.g.
CREATE INDEX ON table1(col1) WHERE col1 > 10 TABLESPACE my_tbl_spc;
This is invalid SQL. Instead should be
CREATE INDEX ON table1(col1) TABLESPACE my_tbl_spc WHERE col1 > 10;
Possible solution:
IF (ARRAY_length(regexp_matches(v_sql, ' WHERE ', 'i'), 1) > 0)
THEN
v_sql := regexp_replace (v_sql, ' WHERE ', format(' TABLESPACE %I WHERE ', v_index_list.tablespace_name), 'i' );
ELSE
v_sql := v_sql || format(' TABLESPACE %I', v_index_list.tablespace_name); -- THIS IS THE CURRENT STATEMENT
The text was updated successfully, but these errors were encountered:
You're correct in that partial indexes would cause an issue here. However, this code block is only handling unique indexes, so it would be a bit odd for that to occur. I'll still include the fix to handle the odd edge case. Thank you!
In this function: inherit_template_properties
If there is a partial index and also tablespace then the query formed adds TABLESPACE clause to the end like below:
e.g.
CREATE INDEX ON table1(col1) WHERE col1 > 10 TABLESPACE my_tbl_spc;
This is invalid SQL. Instead should be
CREATE INDEX ON table1(col1) TABLESPACE my_tbl_spc WHERE col1 > 10;
Possible solution:
IF (ARRAY_length(regexp_matches(v_sql, ' WHERE ', 'i'), 1) > 0)
THEN
v_sql := regexp_replace (v_sql, ' WHERE ', format(' TABLESPACE %I WHERE ', v_index_list.tablespace_name), 'i' );
ELSE
v_sql := v_sql || format(' TABLESPACE %I', v_index_list.tablespace_name); -- THIS IS THE CURRENT STATEMENT
The text was updated successfully, but these errors were encountered: