To be clear, I want to know what is the mechanism that is used to populate the default value not the SQL syntax needed to create the default value constraint on the table.
Does Postgres use some kind of trigger that updates the default value if it is missing or something else?. I couldn't find an explanation on the official website.
This happens in the
rewriteTargetListIUfunction insrc/backend/rewrite/rewriteHandler.c. The comment says it all:So this happens during query rewrite, which is the step between parsing the SQL string and optimizing it.