Q. When I deploy the PostgreSQL project, user’s grants are rolled up before creating the user itself and deploy transaction is canceled, WTF?
A. A short answer: One should create roles; move all grants to the roles. The users must be included in the roles only.
Yes, PG users are simply alias from the role (here one could make a few critical remarks about the PG grant system but let us drop it). However, if used carelessly, one likely rubs the wrong way eventually. It seems to me that it is just a box of dynamite to find in a year of development that I cannot delete some irrelevant users because they have some disjointed grants, or worse, some objects in the DB. It seems to me that a good tool should warn against similar actions.