diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 1c188b7a0ff..f7fa1b901d1 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -3001,7 +3001,7 @@ AddRelationNotNullConstraints(Relation rel, List *constraints,
 			{
 				if (other->is_no_inherit != constr->is_no_inherit)
 					ereport(ERROR,
-							errcode(ERRCODE_SYNTAX_ERROR),
+							errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 							errmsg("conflicting NO INHERIT declaration for not-null constraint on column \"%s\"",
 								   strVal(linitial(constr->keys))));
 
@@ -3015,7 +3015,7 @@ AddRelationNotNullConstraints(Relation rel, List *constraints,
 						constr->conname = pstrdup(other->conname);
 					else if (strcmp(constr->conname, other->conname) != 0)
 						ereport(ERROR,
-								errcode(ERRCODE_SYNTAX_ERROR),
+								errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 								errmsg("conflicting not-null constraint names \"%s\" and \"%s\"",
 									   constr->conname, other->conname));
 				}
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index f0c7755b8fb..0210b568a1e 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -749,7 +749,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 			case CONSTR_NULL:
 				if ((saw_nullable && column->is_not_null) || need_notnull)
 					ereport(ERROR,
-							(errcode(ERRCODE_SYNTAX_ERROR),
+							(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 							 errmsg("conflicting NULL/NOT NULL declarations for column \"%s\" of table \"%s\"",
 									column->colname, cxt->relation->relname),
 							 parser_errposition(cxt->pstate,
@@ -767,7 +767,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 				/* Disallow conflicting [NOT] NULL markings */
 				if (saw_nullable && !column->is_not_null)
 					ereport(ERROR,
-							(errcode(ERRCODE_SYNTAX_ERROR),
+							(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 							 errmsg("conflicting NULL/NOT NULL declarations for column \"%s\" of table \"%s\"",
 									column->colname, cxt->relation->relname),
 							 parser_errposition(cxt->pstate,
@@ -775,7 +775,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 
 				if (disallow_noinherit_notnull && constraint->is_no_inherit)
 					ereport(ERROR,
-							errcode(ERRCODE_SYNTAX_ERROR),
+							errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 							errmsg("conflicting NO INHERIT declarations for not-null constraints on column \"%s\"",
 								   column->colname));
 
@@ -812,7 +812,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 
 					if (notnull_constraint->is_no_inherit != constraint->is_no_inherit)
 						ereport(ERROR,
-								errcode(ERRCODE_SYNTAX_ERROR),
+								errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 								errmsg("conflicting NO INHERIT declarations for not-null constraints on column \"%s\"",
 									   column->colname));
 
@@ -825,7 +825,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 			case CONSTR_DEFAULT:
 				if (saw_default)
 					ereport(ERROR,
-							(errcode(ERRCODE_SYNTAX_ERROR),
+							(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 							 errmsg("multiple default values specified for column \"%s\" of table \"%s\"",
 									column->colname, cxt->relation->relname),
 							 parser_errposition(cxt->pstate,
@@ -855,7 +855,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 
 					if (saw_identity)
 						ereport(ERROR,
-								(errcode(ERRCODE_SYNTAX_ERROR),
+								(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 								 errmsg("multiple identity specifications for column \"%s\" of table \"%s\"",
 										column->colname, cxt->relation->relname),
 								 parser_errposition(cxt->pstate,
@@ -877,7 +877,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 						need_notnull = true;
 					else if (!column->is_not_null)
 						ereport(ERROR,
-								(errcode(ERRCODE_SYNTAX_ERROR),
+								(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 								 errmsg("conflicting NULL/NOT NULL declarations for column \"%s\" of table \"%s\"",
 										column->colname, cxt->relation->relname),
 								 parser_errposition(cxt->pstate,
@@ -892,7 +892,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 							 errmsg("generated columns are not supported on typed tables")));
 				if (saw_generated)
 					ereport(ERROR,
-							(errcode(ERRCODE_SYNTAX_ERROR),
+							(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 							 errmsg("multiple generation clauses specified for column \"%s\" of table \"%s\"",
 									column->colname, cxt->relation->relname),
 							 parser_errposition(cxt->pstate,
@@ -910,7 +910,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 			case CONSTR_PRIMARY:
 				if (saw_nullable && !column->is_not_null)
 					ereport(ERROR,
-							(errcode(ERRCODE_SYNTAX_ERROR),
+							(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 							 errmsg("conflicting NULL/NOT NULL declarations for column \"%s\" of table \"%s\"",
 									column->colname, cxt->relation->relname),
 							 parser_errposition(cxt->pstate,
@@ -975,7 +975,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 
 		if (saw_default && saw_identity)
 			ereport(ERROR,
-					(errcode(ERRCODE_SYNTAX_ERROR),
+					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 					 errmsg("both default and identity specified for column \"%s\" of table \"%s\"",
 							column->colname, cxt->relation->relname),
 					 parser_errposition(cxt->pstate,
@@ -983,7 +983,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 
 		if (saw_default && saw_generated)
 			ereport(ERROR,
-					(errcode(ERRCODE_SYNTAX_ERROR),
+					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 					 errmsg("both default and generation expression specified for column \"%s\" of table \"%s\"",
 							column->colname, cxt->relation->relname),
 					 parser_errposition(cxt->pstate,
@@ -991,7 +991,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 
 		if (saw_identity && saw_generated)
 			ereport(ERROR,
-					(errcode(ERRCODE_SYNTAX_ERROR),
+					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 					 errmsg("both identity and generation expression specified for column \"%s\" of table \"%s\"",
 							column->colname, cxt->relation->relname),
 					 parser_errposition(cxt->pstate,
