Hey everyone, I just fixed a mysterious error I was seeing in my httpd/errors log file. It said:
[Wed Dec 12 09:49:00 2001] [notice] child pid 32655 exit signal Segmentation fault (11)
[Wed Dec 12 09:49:03 2001] [error] NOTICE: Adding missing FROM-clause entry for table "ftr_cal_calendar"

This was also accompanied by "Blank Pages" in ie with a generic DNS error message, or in Netscape, a "Page contains no data" error.

I am using PHP 4.0.6, PostgreSQL 7.1.2 and Apache 1.3.20

As it turns out, it is a very simple thing to do when using postgresql and php. It may be valid with other programming languages too.

Here's an example SQL statement:
SELECT ftr_cal_events.*
FROM ftr_cal_events
WHERE ftr_cal_events.calendarid = ftr_cal_calendar.calendarid
AND ftr_cal_calendar.name = 'something'
AND ftr_cal_calendar.accountid = 'somethingelse'

Notice that I'm joining ftr_cal_events to ftr_cal_calendar on calendarid. The query works just fine, despite the fact that there is no explicit reference to ftr_cal_calendar in the FROM clause.

Putting this query on a page and then viewing that page about 10 times will result in 10 messages in your error log and 6-7 blank or "page contains no data" page views.

Matthew Nuzum
followers.net

    • [deleted]

    A strange bug, it should just say the query is bad.

    have you reported this to the PHP and PostgreSQL people?

      I've had the same problem (and posted a message here about it).

      I think I'll go to PHP and put it into the bug database there.

      Basically, postgresql is sending out a warning, not an error, since strict SQL compliance requires even tables that are explicitly listed by the table.column format still have to be referenced in the from clause.

      Somewhere along the line, php and apache are having issues with passing this error into the error logs and crashing.

      I'm glad someone else can confirm the problem I've been having.

        • [deleted]

        Scott, you disappoint me :-)
        You actually write queries without specifying all the tables used in the JOINs? 🙂

          Hey, I was a young pup, what can I say. Of course, they're of the form

          table1.field1, table2.field2 etc... so they didn't even have a from clause.

            • [deleted]

            :-)

              Write a Reply...