***************
*** 518,527 ****
  	initStringInfo(&buf);
  
  	tgname = NameStr(trigrec->tgname);
! 	appendStringInfo(&buf, "CREATE %sTRIGGER %s",
! 					 trigrec->tgisconstraint ? "CONSTRAINT " : "",
  					 quote_identifier(tgname));
- 	appendStringInfoString(&buf, pretty ? "\n    " : " ");
  
  	if (TRIGGER_FOR_BEFORE(trigrec->tgtype))
  		appendStringInfo(&buf, "BEFORE");
--- 518,526 ----
  	initStringInfo(&buf);
  
  	tgname = NameStr(trigrec->tgname);
! 	appendStringInfo(&buf, "CREATE %sTRIGGER %s ",
! 					 trigrec->tgisconstraint ? "CONSTRAINT" : "",
  					 quote_identifier(tgname));
  
  	if (TRIGGER_FOR_BEFORE(trigrec->tgtype))
  		appendStringInfo(&buf, "BEFORE");
***************
*** 573,605 ****
  			appendStringInfo(&buf, " TRUNCATE");
  		findx++;
  	}
! 	appendStringInfo(&buf, " ON %s",
  					 generate_relation_name(trigrec->tgrelid, NIL));
- 	appendStringInfoString(&buf, pretty ? "\n    " : " ");
  
  	if (trigrec->tgisconstraint)
  	{
  		if (OidIsValid(trigrec->tgconstrrelid))
! 		{
! 			appendStringInfo(&buf, "FROM %s",
  							 generate_relation_name(trigrec->tgconstrrelid, NIL));
- 			appendStringInfoString(&buf, pretty ? "\n    " : " ");
- 		}
  		if (!trigrec->tgdeferrable)
  			appendStringInfo(&buf, "NOT ");
  		appendStringInfo(&buf, "DEFERRABLE INITIALLY ");
  		if (trigrec->tginitdeferred)
! 			appendStringInfo(&buf, "DEFERRED");
  		else
! 			appendStringInfo(&buf, "IMMEDIATE");
! 		appendStringInfoString(&buf, pretty ? "\n    " : " ");
  	}
  
  	if (TRIGGER_FOR_ROW(trigrec->tgtype))
! 		appendStringInfo(&buf, "FOR EACH ROW");
  	else
! 		appendStringInfo(&buf, "FOR EACH STATEMENT");
! 	appendStringInfoString(&buf, pretty ? "\n    " : " ");
  
  	/* If the trigger has a WHEN qualification, add that */
  	value = fastgetattr(ht_trig, Anum_pg_trigger_tgqual,
--- 572,598 ----
  			appendStringInfo(&buf, " TRUNCATE");
  		findx++;
  	}
! 	appendStringInfo(&buf, " ON %s ",
  					 generate_relation_name(trigrec->tgrelid, NIL));
  
  	if (trigrec->tgisconstraint)
  	{
  		if (OidIsValid(trigrec->tgconstrrelid))
! 			appendStringInfo(&buf, "FROM %s ",
  							 generate_relation_name(trigrec->tgconstrrelid, NIL));
  		if (!trigrec->tgdeferrable)
  			appendStringInfo(&buf, "NOT ");
  		appendStringInfo(&buf, "DEFERRABLE INITIALLY ");
  		if (trigrec->tginitdeferred)
! 			appendStringInfo(&buf, "DEFERRED ");
  		else
! 			appendStringInfo(&buf, "IMMEDIATE ");
  	}
  
  	if (TRIGGER_FOR_ROW(trigrec->tgtype))
! 		appendStringInfo(&buf, "FOR EACH ROW ");
  	else
! 		appendStringInfo(&buf, "FOR EACH STATEMENT ");
  
  	/* If the trigger has a WHEN qualification, add that */
  	value = fastgetattr(ht_trig, Anum_pg_trigger_tgqual,
