*** a/src/backend/commands/createas.c
--- b/src/backend/commands/createas.c
***************
*** 218,224 **** GetIntoRelEFlags(IntoClause *intoClause)
  	 * because it doesn't have enough information to do so itself (since we
  	 * can't build the target relation until after ExecutorStart).
  	 */
! 	if (interpretOidsOption(intoClause->options))
  		flags = EXEC_FLAG_WITH_OIDS;
  	else
  		flags = EXEC_FLAG_WITHOUT_OIDS;
--- 218,225 ----
  	 * because it doesn't have enough information to do so itself (since we
  	 * can't build the target relation until after ExecutorStart).
  	 */
! 	if (intoClause->relkind != RELKIND_MATVIEW &&
! 		interpretOidsOption(intoClause->options))
  		flags = EXEC_FLAG_WITH_OIDS;
  	else
  		flags = EXEC_FLAG_WITHOUT_OIDS;
*** a/src/backend/commands/tablecmds.c
--- b/src/backend/commands/tablecmds.c
***************
*** 559,565 **** DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId)
  	 */
  	descriptor = BuildDescForRelation(schema);
  
! 	localHasOids = interpretOidsOption(stmt->options);
  	descriptor->tdhasoid = (localHasOids || parentOidCount > 0);
  
  	/*
--- 559,568 ----
  	 */
  	descriptor = BuildDescForRelation(schema);
  
! 	if (relkind == RELKIND_MATVIEW)
! 		localHasOids = false;
! 	else
! 		localHasOids = interpretOidsOption(stmt->options);
  	descriptor->tdhasoid = (localHasOids || parentOidCount > 0);
  
  	/*
