PostgreSQL is requiring explicit schema declaration

Answered

Running Intellij 2020.1.2, I can no longer specify a Postgres table without also including the schema name. To make things simple, I only selected a single schema (public):

However, whenever I refer to a table in that schema, Intellij is unable to resolve the table unless I include the schema name.

What am I missing?

1
5 comments
Avatar
Yuriy Vinogradov

Please check that 'public' schema is added to search path or you have selected corresponding schema for session:

0
Avatar
Permanently deleted user

Thanks, Yuriy, but my screen doesn't have those controls (schema drop-down or DB connection labelled as "default" for you). I couldn't find those controls in any menus, toolbar options, or preferences. I just have the Database Toolbar view:

 

How do I get to those controls? Is there a menu or preference setting for the search path?

0
Avatar
Yuriy Vinogradov

It appears when you open 'query console' via right-click on any object in database object tree, or when attach session to your working file (ctrl+shift+a -> attach session action).

0
Avatar
Permanently deleted user

I should have given you more context. The concern is that my .sql source files are full of red where all the tables are reporting "Unable to resolve table <tablename>". 

If I attach a session to my file, I can indeed select the schema. The default schema includes "public", but I still get the errors. However, if I change the schema to add something like Postgres' built-in information_schema, I get prompted to introspect the schema and everything looks fine.

But if I then close my project and re-open it, I am back to red again. I need to go through the process every time for the introspections to work.

I have recently upgraded from 2016.1, which works fine. I think I need to downgrade back to that version until there is a fix for this.

0
Avatar
Yuriy Vinogradov

Please go to Settings -> Languages&Frameworks -> SQL resolution scopes  and set up mapping for path (directory or file) or entire project and data source, that should do the trick.

1

Please sign in to leave a comment.