Magento addAttributeToFilter不按照我认为应该的方式工作

I have a product attribute that I have set the scope to website (so in theory it would be different on each website defined).

However for some reason when I use it in an addAttributeToFilter() it seems to ignore it.

Let me show you the code I am using:

$total_products_obj = Mage::getModel('catalog/product')
  ->getCollection()
  ->addAttributeToSelect('*')
  ->addAttributeToFilter('discontinued', array('neq' => 1) )
  ->addAttributeToFilter('video_url', array('notnull' => '') );

The attribute I am having trouble with is the video_url attribute. Like I said it's scope is set to Website where discontinued is a Global attribute.

I have not really done much with Website attributes, is there something else that I need to do in order to get this attribute to not be ignored? Right now I am getting a collection of all the products where discontinued does not equal 1.

I turned off Use Flat Catalog Product and it started to work as expected.

I have found a workaround. Use the array version of the method instead, really intended for creating an 'OR' condition. This generates the correct SQL.

E.g.

->addAttributeToFilter( array( array( 'attribute'=>'video_url', 'notnull' => '' ) ))

It's a bit ugly but allows you to still use the flat catalog.