473,799 Members | 2,840 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4496
On Tue, Jan 27, 2004 at 13:00:15 -0500,
John Siracusa <si******@minds pring.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_fro m = false

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.ph a.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*******@postg resql.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_fro m = 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***********@j abber.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
2477
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" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
2
6399
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 don't understand. Aside from that notice, the script appears to work as intended, i.e., updating existing report definitions and adding any new ones defined in the dev environment but not appearing in QAT. Here is the script: \set...
6
3077
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 record such as: part number 202354-001 location C1-01
1
3402
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
1473
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 fact it should error out). I searched and found references to changing the postgresql.conf with: add_missing_from = false enable_implicited_join = false But neither one of these seems to disable the functionality (I did a reload after making...
3
4769
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 FROM-clause entry for table "t3"
3
1243
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 date for the same room. I'm getting the following error message: Runtime error 3075. Syntax error (missing operator) in query expression '(Room = 189B) AND (InspectionDate = #10/05/05#)'. Here is the code:
12
6224
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 datagrid. Once I can get to that point I need some way to be able to add new data only to the new columns that were added. Here is some of my code: //Function For Importing Data From CSV File public DataSet ConnectCSV(string filetable)
6
3110
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 = 1;
0
10482
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.