Re: warning for subquery that references a table but not its columns - Mailing list pgsql-general

From Tom Lane
Subject Re: warning for subquery that references a table but not its columns
Date
Msg-id 15194.1516333782@sss.pgh.pa.us
Whole thread Raw
In response to warning for subquery that references a table but not its columns  (Seamus Abshere <seamus@abshere.net>)
List pgsql-general
Seamus Abshere <seamus@abshere.net> writes:
> Should there be a warning for the first query that you reference "tracks" in a subquery but don't use any columns
fromit? 

Unfortunately, outer references in subqueries are perfectly legal per SQL
standard, and also often essential.

If we were to invent a "SET training_wheels = on" option, it would surely
include some warnings in this area, although I'm not sure exactly what the
triggering conditions ought to be.  But there are lots of ways to mess
yourself up in SQL; I don't think subqueries are that much worse than
some other gotchas.

            regards, tom lane


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Possible hang in 10.1 with JSON query over partially indexed partitions
Next
From: Abhra Kar
Date:
Subject: Re: Call sql function in psql