Joachim Wieland <j...@mcknight.de> wrote:

> I'm getting an assertion failure in HEAD with materialized views

> To reproduce, just run make installcheck, dump the regression
> database and then restore it, the server crashes during restore.

I failed to touch everything necessary to prevent MVs from having
OIDs.  This patch fixes the reported problem, and doesn't leave any
gaps as far as I know; but I will do additional review to try to
catch any other omissions.  I figured I should address the reported
problem now, though.

Will push later today if there are no objections.

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
*** 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);
  
  	/*
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to