SQL Debugging Aide - Mailing list pgsql-general

From Mike Mascari
Subject SQL Debugging Aide
Date
Msg-id 3B85104B.7006EE72@mascari.com
Whole thread Raw
List pgsql-general
Is there any option that one might set to have PostgreSQL emit a
NOTICE when it encounters a SELECT statement having a table not
involved in any join condition?

For example, if I do:

SELECT employees.name
FROM employees, salaries;

It would aide debugging application development a bit if there was a
way to have PostgreSQL emit a NOTICE like:

NOTICE: Cartesian product generated for table 'salaries'

in the same manner that it now adds a notice for missing FROM clause
entries.

I realize that there are queries like the above where the results
are as expected, which is why it would be nice for it to be some
option. The above is obvious, but some of my queries contain joins
with > 15 tables. In development, when some of the tables are empty
or only contain 1 record, the results may appear to work. Only until
later would I discover a missing join condition when more then 1 row
is added.

Just a thought,

Mike Mascari
mascarm@mascari.com

pgsql-general by date:

Previous
From: Fernando Schapachnik
Date:
Subject: Re: Postgres and special character
Next
From: "Andrew Snow"
Date:
Subject: RE: Re: SELECT FOR UPDATE