Search code examples
postgresqlintellij-ideapgadmin-4

Select subquery not working in Intellij idea


I have the following query (Assume that the tables are present):

select tmp.ship_country 
from (
  select o.ship_country, count (*) c 
  from orders o 
  group by o.ship_country 
  order by c desc limit 1
) tmp;

When I attempt to run this via IntelliJ Idea Database Browser, I get following error:

Error executing SELECT statement: ERROR: subquery in FROM must have alias. HINT: For example, FROM (SELECT...) [AS] foo. Position: 30

The same query runs fine when executed from PGADMIN4. Below are the associated screenshots:

When executed from IntelliJ idea

Error Message In IntelliJ

Query Executed from PgAdmin 4

Correct Result in PgAdmin4

Am I missing something or is this a bug in Idea? I am using IntelliJ Idea 2019.3 (CE).

CE having Database Navigator


Solution

  • The Database Navigator Plugin available for IntelliJ IDEA Community Edition isn't provided by JetBrains (anymore) and has nothing to do with the DataGrip extension or IDE that is available with the Ultimate Edition.

    The error you are facing is a bug in the https://plugins.jetbrains.com/plugin/1800-database-navigator/ plugin.

    I could reproduce that bug with current release 3.2.0564.

    Created issue: https://database-navigator.atlassian.net/browse/DBNB-33