3

I am able to connect with psql and do what I want, not in IntelliJ.

PostgreSQL version : postgres (PostgreSQL) 9.6.1
IntelliJ version : 2016.3.1

IntelliJ configuration :

URL : jdbc:postgresql://localhost:5432/sample
User : sample
Pwd : sample

Test connection : Successful

So, I connect (red square appears) and then try a simple query :

select 1;

And I got the error :

FATAL : role 'xxx' doesn't exist`

Why IntelliJ doesn't use the role specified in my configuration and want to use my personal login ?? Whatever I use as role, still got the same error.

Note: If I add my system username as role it works, but I would prefer to avoid that.

Kevin Amiranoff
  • 13,440
  • 11
  • 59
  • 90
user2668735
  • 1,048
  • 2
  • 18
  • 30
  • That did it for me : http://stackoverflow.com/questions/15301826/psql-fatal-role-postgres-does-not-exist – Kevin Amiranoff Jan 11 '17 at 08:46
  • No It is not the same case. I already have the postgres user, and I can do exactly what I want in CLI. I think it is just an IntelliJ configuration problem. – user2668735 Jan 11 '17 at 20:41

1 Answers1

1

Adding the LOGIN role attribute fix the problem :

ALTER ROLE sample LOGIN

The documenation states :

Only roles that have the LOGIN attribute can be used as the initial role name for a database connection

However, I could connect in CLI and do what I want, as I could "connect" in IntelliJ but not do query, without this attribute. More details about this behaviour are welcome.

user2668735
  • 1,048
  • 2
  • 18
  • 30