Code inspection not recognising table names

Hi all,

 

I have a project open in PHPStorm and on the right it is showing my connection to the database and relevant schema.

I can expand the tables and see the fields etc in the database "window".

My problem is in my actual code, within the SQL statements it is not recognising the table names.

Any idea how to fix this please?

Thanks in advance!

5 comments
Comment actions Permalink

Well this is a useful support tool..... not :/

0
Comment actions Permalink

Hi there,

Try check stuff at "Settings (Preferences on macOS) | Languages & Frameworks | SQL Resolution Scopes"

https://www.jetbrains.com/help/phpstorm/2019.2/settings-languages-sql-resolution-scopes.html

Could also be related to how your DB Connection is defined (how many schemas are available for that login/what schema is selected in DB connection).

In my project where no ORM is used (so it has SQL queries like yours), it works just fine right out of the box, so it's hard to suggest something more specific for me right now.

1
Comment actions Permalink

Thank you Andriy :)

I was using a username in the DB Connection that had access to 15 databases.

I changed to using a username that only had access to the database in question and now it works fine.

I'm not 100% sure if this is intended functionality or a bug - but you have solved it so thank you very much!

0
Comment actions Permalink

>I'm not 100% sure if this is intended functionality or a bug

I think it should be a matter of settings: what schemas were selected in DB Connection properties and use that SQL Resolution Scopes (select desired DB for the whole project) -- should have worked.

I'm always trying to use minimal access policy (or whatever the proper name is for that; so user can access single DB only) and it works just fine for me during development -- never faced such issue before.

0

Please sign in to leave a comment.