Don't treate IndexStmt like AlterTable when DefineIndex is called from ProcessUtilitySlow. - Mailing list pgsql-hackers

From 正华吕
Subject Don't treate IndexStmt like AlterTable when DefineIndex is called from ProcessUtilitySlow.
Date
Msg-id CANerzActdrdFO1r4RSqK0M2d0Xtwu5t5bH=ZOoLsAQ=HhZrB=g@mail.gmail.com
Whole thread Raw
Responses Re: Don't treate IndexStmt like AlterTable when DefineIndex is called from ProcessUtilitySlow.
List pgsql-hackers
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
Attachment

pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Introduce a new view for checkpointer related stats
Next
From: Bharath Rupireddy
Date:
Subject: Re: Report checkpoint progress with pg_stat_progress_checkpoint (was: Report checkpoint progress in server logs)