New warning code for missing FROM relations

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема New warning code for missing FROM relations
Дата
Msg-id 200006030440.AAA01918@candle.pha.pa.us
обсуждение исходный текст
Ответы Re: New warning code for missing FROM relations  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: New warning code for missing FROM relations  (Philip Warner <pjw@rhyme.com.au>)
Список pgsql-hackers
I have committed new warning code to alert users who auto-create
relations without knowing it.

The new code does not throw a warning for:
SELECT pg_language.*;

but does throw one for:
SELECT pg_language.* FROM pg_class

The code issues the warning if it auto-creates a range table entry, and
there is already a range table entry identified as coming from a FROM
clause.  Correlated subqueries should not be a problem because they are
not auto-created.

The regression tests run fine, except for:SELECT *   INTO TABLE tmp1   FROM tmp   WHERE onek.unique1 < 2;NOTICE:
Addingmissing FROM-clause entry for table onekDROP TABLE tmp1;SELECT *   INTO TABLE tmp1   FROM tmp   WHERE
onek2.unique1< 2;NOTICE:  Adding missing FROM-clause entry for table onek2
 

Seems those warnings are justified.  In fact, I am not even sure what
these queries are trying to do.  I have modified the expected files so
they now expect to see the warnings.

A bigger question is whether we should issue ERROR for these queries. 
If they have already used a FROM clause, why would they have other
relations not specified there?

If people have other suggestions about this, I would be glad to modify
the code.  A new function warnAutoRange() does the checking.

--  Bruce Momjian                        |  http://www.op.net/~candle pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: SAKAIDA Masaaki
Дата:
Сообщение: trim() spec
Следующее
От: Tom Lane
Дата:
Сообщение: Re: New warning code for missing FROM relations