473,387 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Adding missing FROM clause - thanks or no thanks?

I recently had a problem where a bunch of postgres backends were taking up
huge amounts of CPU time. I found a bunch of log messages like this:

NOTICE: adding missing FROM-clause entry for table "b"

Which I eventually tracked to an improperly constructed query that reduced
to something like this:

select a1, a2 FROM a WHERE a1 = '...' AND b.b1 = '...';

Table b is pretty big and the conditions were such that it was (apparently)
doing a join of every row in a with every possible row of b. That's
certainly now what I wanted.

Anyway, I fixed the query construction bug, but I have a question: is this
"adding missing FROM-clause entry" behavior part of the SQL standard(s) or a
"feature" of Postgres? Prior to seeing this, I'd have expected a query like
the above to cause a fatal error in the parsing stage. Put another way, can
someone give me an example of when this behavior is useful or desirable?

-John
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 22 '05 #1
4 4465
On Tue, Jan 27, 2004 at 13:00:15 -0500,
John Siracusa <si******@mindspring.com> wrote:

Anyway, I fixed the query construction bug, but I have a question: is this
"adding missing FROM-clause entry" behavior part of the SQL standard(s) or a
"feature" of Postgres? Prior to seeing this, I'd have expected a query like
the above to cause a fatal error in the parsing stage. Put another way, can
someone give me an example of when this behavior is useful or desirable?


It is an extension. I think starting with 7.4 you can turn it off.
It is sort of useful for delete where there isn't a syntax to specify
addition tables, though I think you can get the same functionality
even there using subselects in the where clause.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 22 '05 #2
John Siracusa wrote:
I recently had a problem where a bunch of postgres backends were taking up
huge amounts of CPU time. I found a bunch of log messages like this:

NOTICE: adding missing FROM-clause entry for table "b"

Which I eventually tracked to an improperly constructed query that reduced
to something like this:

select a1, a2 FROM a WHERE a1 = '...' AND b.b1 = '...';

Table b is pretty big and the conditions were such that it was (apparently)
doing a join of every row in a with every possible row of b. That's
certainly now what I wanted.

Anyway, I fixed the query construction bug, but I have a question: is this
"adding missing FROM-clause entry" behavior part of the SQL standard(s) or a
"feature" of Postgres? Prior to seeing this, I'd have expected a query like
the above to cause a fatal error in the parsing stage. Put another way, can
someone give me an example of when this behavior is useful or desirable?


It is a PostgreSQL extension and can be turned off with a
postgresql.conf variable or via SET:

add_missing_from = false

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 22 '05 #3
On 1/27/04 1:28 PM, Bruno Wolff III wrote:
It is an extension. I think starting with 7.4 you can turn it off.
It is sort of useful for delete where there isn't a syntax to specify
addition tables, though I think you can get the same functionality
even there using subselects in the where clause.
On 1/27/04 1:34 PM, Bruce Momjian wrote: It is a PostgreSQL extension and can be turned off with a
postgresql.conf variable or via SET:

add_missing_from = false


Great, thanks to both of you :)

-John
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 22 '05 #4
Dear John Siracusa ,
Are you using version

7.4.x if no whats the version of PostgreSQL ?

AFAIK this limitation was introduced in 7.4.x refer the docs to verify.
Some of my application's query developed on 7.3.x also reported same
errors/ suggestions when same was taken to 7.4.x
I added the from tabel and all went well
but this behaviour is relent for subqueries.
I recently had a problem where a bunch of postgres backends were taking up
huge amounts of CPU time. I found a bunch of log messages like this:



--
Regards,
Vishal Kashyap

~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
I Know you believe my words so logon to Jabber.org
and add vi***********@jabber.org to your roster.
OR
Seek Me at 264360076
~*~*~*~*~*~*~*~*
I am usually called as Vishal Kashyap
but my Girlfriend calls me as Vishal CASH UP.
This is because others identify me because of my generosity
but my Girlfriend identify me because of my CASH.
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
2
by: btober | last post by:
I run the following script to export some data from my development database and then update or insert the records into to the quality assurance testing database, but I get a warning notice that I...
6
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
1
by: Ulrich Wisser | last post by:
Hi, what does that line from my logfile mean? Adding missing FROM-clause entry for table "customer" Would pg change my SQL queries on the fly? TIA
4
by: terry | last post by:
I know that PSQL has the cool feature of doing: Adding missing FROM-clause But I want to disable it, because its silent adding can allow a bad SQL statement to execute a cartesian select (when in...
3
by: C G | last post by:
Dear All, I have a simple join query SELECT c1 FROM t1 INNER JOIN t2 ON t2.c2 = t1.c2 WHERE t3.c3= t2.c3; Which gives the expected result but I get the message NOTICE: adding missing...
3
by: william | last post by:
Hello Everyone, I'm using Access 2000. I entered the following code to do some data validation, however it is not working. I'm trying to ensure that the user cannot enter a duplicate inspection...
12
by: JMO | last post by:
I can import a csv file with no problem. I can also add columns to the datagrid upon import. I want to be able to start importing at the 3rd row. This will pick up the headers necessary for the...
6
by: jackal_on_work | last post by:
Hi Faculties, I have two queries which give me the same output. -- Query 1 SELECT prod.name, cat.name FROM products prod INNER JOIN categories cat ON prod.category_id = cat.id WHERE cat.id...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.