title: psql: FATAL: Ident authentication failed for user "xxx" with method trust
body: <p>I've created a new role and Database in the following way (with postgres user):</p>
  
  <pre><code>CREATE ROLE xxx LOGIN
    PASSWORD 'CHOOSEAPASSWORD'
    NOSUPERUSER INHERIT NOCREATEDB CREATEROLE REPLICATION;
  
  CREATE DATABASE xxx
    WITH OWNER = xxx
         ENCODING = 'UTF8'
         TABLESPACE = pg_default
         CONNECTION LIMIT = -1;
  
  \connect xxx
  GRANT ALL ON DATABASE xxx TO xxx;
  GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO xxx;
  </code></pre>
  
  <p>In the pg_hba.conf I've the following entries:</p>
  
  <pre><code>local   all             postgres                                trust
  local   all             all                                     peer
  # IPv4 local connections:
  host    all             xxx             127.0.0.1/32            trust
  host    all             all             127.0.0.1/32            ident
  </code></pre>
  
  <p>Nevertheless I can't connect with </p>
  
  <pre><code>psql -U xxx -h localhost -W
  </code></pre>
  
  <p>and get the error</p>
  
  <pre><code>psql: FATAL:  Ident authentication failed for user "xxx"
  </code></pre>
  
  <p>Any ideas where I could have a mistake? (I use PostgreSQL 9.4 and CentOS 6.7)</p>