From: Tom Lane <tgl@sss.pgh.pa.us>
To: Seamus Abshere <seamus@abshere.net>
Cc: pgsql-general@postgresql.org
Subject: Re: warning for subquery that references a table but not its columns
Date: Thu, 18 Jan 2018 22:49:42 -0500
Message-ID: <15194.1516333782@sss.pgh.pa.us> (raw)
In-Reply-To: <1516309526.4088210.1240289384.0CDAD7E3@webmail.messagingengine.com>
References: <1516309526.4088210.1240289384.0CDAD7E3@webmail.messagingengine.com>
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 from it?
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, seamus@abshere.net
Subject: Re: warning for subquery that references a table but not its columns
In-Reply-To: <15194.1516333782@sss.pgh.pa.us>
References: <1516309526.4088210.1240289384.0CDAD7E3@webmail.messagingengine.com> <15194.1516333782@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox