Hi, Recently read the code, I find that when calling DefineIndex from ProcessUtilitySlow, is_alter_table will be set true if this statement is came from expandTableLikeClause.
I check the code of DefineIndex, there are only two places use
is_alter_table:
1. the function index_check_primary_key
2. print a debug log on what the statement is
For 1, since we are doing create table xxx (like yyy including
indexes), we are sure that the check relationHasPrimaryKey in the
function index_check_primary_key will be satisfied because we are just
create the new table.
For 2, I do not think it will mislead the user if we print it as
CreateStmt.
Based on the above, I think we can always a false value
for is_alter_table when DefineIndex is called from
ProcessUtilitySlow.
Here I attach a patch. Any ideas?
Thanks a lot.
Best,
Zhenghua Lyu
0001-Don-t-treate-IndexStmt-like-AlterTable-when-DefineIn.patch
Description: Binary data
