Why the post ID is 0 in a hook within wp_insert_post_data?

As deduced from the comments, and the source code, the ID for new posts is only generated after the hook wp_insert_post_data, the wordpress codex is misleading in this regard.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)