PSQLException: ERROR: null value in column violates not-null constraint

As @mu commented, the error message contradicts the rest of your question.
The only reasonable explanation left is that you are, in fact, writing to a different table.

Try:

INSERT INTO users (user_id, name, username, password)
VALUES
  (1234,'foo', 'foo', 'foo')";

And check your table. Did the INSERT arrive at the table you expected? If not, check your settings:

  • IP, port, db name?
  • Same schema in the DB? Check your search_path setting.
  • You did not by accident double quote the table name "USERS"? Double-quoted identifiers are not cast to lower case. Read the chapter Identifiers and Key Words for details..

Find the other instance of table users and fix potential damage you may have done. :)