How to write a no-op UPDATE query? Suppose we have a simple update query:

UPDATE foo
SET
  bar=$1
WHERE id=$2


where bar=$1 is generated based on user's input and it might be null, e.g.

UPDATE foo
SET
  ${assignmentList}
WHERE id=$2


How do I make this update operation into a no-op in case assignmentList variable is empty?

I have tried using 1=1, i.e.

UPDATE foo
SET
  1=1
WHERE id=$2


but this gives a syntax error.
It is only slightly more code to skip the UPDATE if there is nothing to do.  And the code is much cleaner.  And less kludgy.