I installed the Link module to replace a text field for a website (field_website) in a node but found the field_website name was still in use, so I checked the other content types and removed field_website, but when I showed the view, I got this error:

user warning: Unknown column 'node_data_field_website.field_website_value' in 'field list' query: SELECT node.nid, node.title AS node_title, node.changed AS node_changed, node_data_field_website.field_website_value AS node_data_field_website_field_website_value, node_data_field_year.field_year_value AS node_data_field_year_field_year_value, node_data_field_engine_name.field_engine_name_nid AS node_data_field_engine_name_field_engine_name_nid, node_data_field_engine_developer.field_engine_developer_nid AS node_data_field_engine_developer_field_engine_developer_nid FROM node node LEFT JOIN content_type_game node_data_field_year ON node.vid = node_data_field_year.vid LEFT JOIN content_type_game node_data_field_engine_name ON node.vid = node_data_field_engine_name.vid LEFT JOIN content_type_game node_data_field_engine_developer ON node.vid = node_data_field_engine_developer.vid WHERE (node.type IN ('game')) ORDER BY node_title ASC LIMIT 0, 10 in ../drupal/includes/database.mysql.inc on line 172.

This error displayed even for anonymous users, which I don't think is very secure (I replaced the beginning path with ".."). I would've rather have simply replaced the field_website content type with the Link module's website field, but CCK doesn't allow that (another bug).

Comments

merlinofchaos’s picture

Project: Views (for Drupal 7) » Content Construction Kit (CCK)
Version: 5.x-1.6-beta5 » 5.x-1.x-dev
Component: Views Data » Views Integration

You have encountered the classic problem of multiple modules interacting. It's pretty difficult to properly do cleanup.

At best, this is a bug against CCK which should go through and clean up views using that field, after it is deleted, but I'm not sure that's necessarily possible to do in a meaningful way.

All I can say is that when you delete stuff like this, you've got to check your views and make sure they aren't still trying to use it. Views has no way to detect this happening that I can think of, and you get the results you see.

I'm passing this over to CCK to get an opinion there.

yched’s picture

After (quick) check, CCK 1.5 calls views_invalidate_cache() (Views 1.6) on a field instance deletion, which forces views data tables cached queries to be recomputed, which should take care of that error (that was my primary intention for pushing the 'cached queries in cache_views' 1.6 feature).

Can you please confirm which version of CCK you're running ?

Eep²’s picture

Version: 5.x-1.x-dev » 5.x-1.5

CCK 5.1.5

tanoshimi’s picture

I had a similar issue. I had textfield called 'venue' which I then decided I wanted to make a node reference field instead, so I deleted the text field and inserted a node reference field called 'venue' instead. Got the errors above.

Then I realised that my views were still trying to show this field, so I went to try to edit them, but the 'venue' field was no longer appearing in their fieldlist. So what I had to do was remove the node reference 'venue' again, and reinsert the field as a text field.
Then went back into my views and removed the text field 'venue' which was now showing up again, before finally removing it again and putting it back as a node reference.

In a nutshell, make sure you follow merlins advice and be sure you delete all references to a field from every view BEFORE you delete it!

StevenK’s picture

i had exactly the same issue, with an image field which I decided that should be replaced by a slideshow. The result was that I had a 20 line "user warning: Unknown column..." in every page, because the filters were in a block which is visible in every page.
The solution I came up with is to create a new custom content to be used as a "storage", ie to add to this custom content every field that is to be completely removed from the rest of the content types. This way, the column exists in the database and is removed from the other content types, and no warnings are displayed.
Furthermore, even if you remove the field, and then you get the error message, you just have to add the 'storage" content type and create the same kind of field again. It will get the same machine readable name.

  • In short: You add the field that is to be removed to a content type that you will not use, so that Drupal will think it's in use and will not delete it. This procedure can be applied even after deleting the field, by creating again the same deleted field, before adding it.
jefbak2’s picture

Version: 5.x-1.5 » 5.x-1.6-1
Component: Views Integration » CCK in core

I need to remove deleted custom fields from all current content.
But when I go in manage fields and delete the field and then edit the content the field is still there.
Help.

yched’s picture

Component: CCK in core » Views Integration

When removing a CCK field, you currently need to remove all references to it in your views (filters, fields, arguments, etc...).
If you do so *after* the field was actually removed, Views is not able to display the field name in the 'view edit' form, and you usually only see an 'empty' row - that's the one you need to remove using the 'trashbin icon' on the right of the row.

As tanoshimi stated in #4 above, best practice is to 'clean' your views *before* actually removing the field.
And as merlin stated in #1, having CCK perform an 'automatic' cleanup of your views when a field is removed is not an easy task...

yched’s picture

Er, actually, after closer reading : jefbak2, what you report is absolutely not related to this thread...

jefbak2’s picture

I was afaid that might be the case. I will open a separate issue. I removed deleted fields from all my views, ran views clear cache, content cleanup, cron and still can't get the deleted fields to go away.

karens’s picture

Status: Active » Closed (won't fix)

The D5 version is no longer being supported. Sorry.