Skip to content

Commit

Permalink
fixed libpg_query errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehmet Emin Karakaş committed May 27, 2023
1 parent ed1d668 commit 84b6add
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ext/pg_query/pg_query_deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -4696,8 +4696,6 @@ static void deparseConstraint(StringInfo str, Constraint *constraint)
appendStringInfoString(str, ") ");
}

deparseOptWith(str, constraint->options);

if (list_length(constraint->fk_attrs) > 0)
{
appendStringInfoChar(str, '(');
Expand Down Expand Up @@ -4800,6 +4798,17 @@ static void deparseConstraint(StringInfo str, Constraint *constraint)
appendStringInfoString(str, ") ");
}

switch (constraint->contype)
{
case CONSTR_PRIMARY:
case CONSTR_UNIQUE:
case CONSTR_EXCLUSION:
deparseOptWith(str, constraint->options);
break;
default:
break;
}

if (constraint->indexname != NULL)
appendStringInfo(str, "USING INDEX %s ", quote_identifier(constraint->indexname));

Expand Down

0 comments on commit 84b6add

Please sign in to comment.