Druapl 5.1
CCk, Views, Date, Calendar,
I added a prefix to the tables for my site, as I intend to use this drupal install for several domains and I understand usign a prefix is a best practice. When using the date field I got an error around table names (see below for error text).
The query should be asking for 'nexusnode_data_field_start_date'
instead of 'node_data_field_start_date'. Off topic: when using a database
prefix, 'nexus_' would make things more readable than 'nexus'.
So in drupal code, the prefix is not being prepended properly, and this is
becuase the database query was written sloppily. Somewhere in the date
module, there is a db_query call being passed "...
node_data_field_start_date ..." when it should be passed "...
{node_data_field_start_date} ..." The brackets cause drupal to prepend the
prefix.
I am not sure where to fix this. I have deleted the date field, the "event" CCK type, and two test nodes. Now the error is on every page. Should I uninstall the module and start over. I want to rename the prefix form"nexus" to "nexus_" but want to fix the bug first. What is the best way to proceed? Thanks.
Comments
Comment #1
karl sf commentedText of Error Message:
user warning: Unknown table 'node_data_field_start_date' in field list query: SELECT node.nid, node.changed AS node_changed_changed, node.title AS node_title, node.changed AS node_changed, node_data_field_start_date.field_start_date_value AS node_data_field_start_date_field_start_date_value, node.type FROM nexusnode node WHERE (node.status = '1') ORDER BY node_changed_changed ASC LIMIT 0, 4 in /home/karl/public_html/home/d5/includes/database.mysql.inc on line 172.
Comment #2
karens commentedTable names like 'node_data_field_start_date' are aliases used in Views, not real table names, so they don't need the prefixes. This is some problem with a View you are trying to run, probably related to recent changes in CCK table names and Views handling.
If you have tried changing the queries manually you will have problems. You need to go back to the latest nightly snapshot of the date module and CCK (which creates most of the Views handling for the Date module). Once you get your code current, you need to check whether an update is needed at update.php. Then you need to go to Views and pull up any Views you have that contain CCK fields and re-save the view so it picks up the new CCK handling.
That should take care of the problem, or at least will rule out the most likely causes of it.
Comment #3
karens commentedBTW, I would avoid using phrases like 'this is because the database query was written sloppily', which is a pretty offensive way to state the issue. Many hours of work have gone into these modules, and while there certainly are legitimate bugs and mistakes, it is not because they were 'written sloppily.'
Comment #4
karl sf commentedYes I agree, and I apologize.
I had sent the error to various people seeking
assistance, and that part of the message I copied and pasted from a
friend's email. I should have looked more closely, and deleted those parts,
notice he is also suggesting to me that I change the prefix to include an
underscore.
I tried to go back and delete that, but the system does not allow editing
a message once posted. I do apologize and most certainly would not
knowingly have posted something offensive or disrespectful or unaprreciative of the work and nature of open source iterative development. I am sorry I caught it too
late.
Comment #5
karens commentedNo problem. I probably should have just ignored it, but I didn't recognize your name and every once in a while I get someone posting issues with comments like 'everything here is done wrong', which gets annoying when you have spent hundreds of hours (for free) working on them.
Since you posted this and also sent me an email to apologize, obviously you're not one of those guys, so I'm sorry I jumped on you.
I'll try to explain the steps more clearly:
1) You need to pick up the very latest versions of the code because there have been fixes that you need. Ordinarily you would use the latest 'official' release, which is what you see linked on the project home pages, but if you're having problems you want to go to the place on the project page that says 'View other releases' and look for the latest development snapshot for your version. It will have a name like 5.x-dev or 4.7-dev. That ensures you are getting the very latest code with all fixes and changes.
2) Once you have the latest versions installed, you will see a link on the admin > site building > modules page to 'update' your database. You should always go to that link and run the update program any time you upload new code versions to your site.
3) In a few cases, when you update your code and it makes changes to your database (and this is one of them), you also need to visit Views to make sure your views all pick up any changes. You will edit each of your views, scan through it to be sure all the selections are still right and that you don't have any fields missing names (which would indicate something that was in your view that will no longer work and needs to be deleted from your view). Even if you don't see anything to change, save the view again to be sure.
After that I think you will be OK, but you can re-open the issue if that does not work.
Comment #6
karl sf commentedWoo hoo!
So far so good. I got the nightly snapshots of Date, CCK, Views,and Calendar and replaced the old module directories.
All is well until I turn on the Calendar Module in the block admin. There is also a calendar_block, which did nothing when I checked it.
Currently when I put the Calendar block in the right column I get the following message, now on every page.
The CCK Content type Event,with date field, does not show up onthe Calendars.
The calendar in the right column only shows current month without navigation to other months.
The error shows the same line as before.
Does this have to do with my prefix for tables in the db? I am hesitant to go the phpMyadmin and change the name of the prefix to "nexus_" as I am afraind that make all existing content and tables out of synch.
"user warning: Unknown table 'node_data_field_date' in where clause query: SELECT node.nid, node.changed AS node_changed_changed, node.title AS node_title, node.changed AS node_changed, node.type FROM nexusnode node WHERE (node.status = '1') AND ((FROM_UNIXTIME(node_data_field_date.field_date_value2) + INTERVAL -28800 SECOND >='2007-02-01%' AND FROM_UNIXTIME(node_data_field_date.field_date_value) + INTERVAL -28800 SECOND <='2007-02-31%')) ORDER BY node_changed_changed ASC LIMIT 0, 99 in /home/karl/public_html/home/d5/includes/database.mysql.inc on line 172."
PS. Is there any way I can be of assistance in fine tuning these modules, considering I don't kow php well? Do you need IA or optimization on any of your sites?
Comment #7
karens commentedOK, I think we're down to a possible Calendar module issue, so I'm moving this and re-activating it so we can be sure. I've been working the Date issue queue and the Calendar issue queue is stacking up, so I plan to get to work on that queue next. There are several bugs reported there and it's possible this is related to one of them.
Comment #8
karens commentedBTW, I would not recommend manually adding a prefix to your tables. If you are in a position to do so, I would start with a fresh install and set it up to use the proper prefix from the beginning.
Comment #9
karens commentedOops. I see you already created a Calendar issue, so I'm moving this back and re-marking it as fixed.
Comment #10
(not verified) commented