Error connecting to the database during installation

Often during the Joomla installation, after entering the correct data, an error may appear:

Could not connect to the database. Connector returned number: Error connecting to PGSQL database.

The solution to the problem is to change "localhost" to "127.0.0.1", because this is the same.