Not sure whether this might be expected behaviour, but if a content type is renamed, it will leave the DB tables with the old name. This essentially makes a renamed content type unusable.

Apologies if this is a) completely obvious or b) already been addressed...

Comments

karens’s picture

Status: Active » Fixed

You've marked this as 5.x and in 5.x content types are maintained by the node module. CCK has no control over them.

beginner’s picture

Project: Content Construction Kit (CCK) » Drupal core
Version: 5.x-1.x-dev » 5.x-dev
Component: content.module » node system
Status: Fixed » Active

This is not fixed.

Changing the type or machine name of any node type will create a sql error:

user warning: Can't find file: './drupal/node_page.frm' (errno: 2) query: RENAME TABLE node_page TO node_administrative_page in includes/database.mysql.inc on line 167.
agentrickard’s picture

Is the original bug report against CCK or Drupal core?

In Drupal core, node names are defined by modules and (it is assumed) will not be changed. If a module developer did change the machine-readable name, then an update function would need to address that in a point release. So, in that instance, the error is the developers fault, and this bug is 'by design.'

If you're talking about CCK-defined nodes, then this is a bug for the CCK module, which should update the node table when a node type name is changed.

beginner’s picture

Project: Drupal core » Content Construction Kit (CCK)
Version: 5.x-dev » 5.x-1.x-dev
Component: node system » content.module

My apologies. I just tested with all cck module disabled, and I cannot reproduce.
But the bug reappears when enabling the content module (cck), so it's definitely a problem with that module.

karens’s picture

I can't reproduce this problem. I can rename a content type and all the appropriate tables get updated with no errors. Do you have other modules installed and does it behave this way if you disable everything but core and CCK? If so, what OS and php versions are you using?

agentrickard’s picture

A better question for me is "What the heck is node_page.frm"? Where does that come from? The forms module?

Find that, and I bet you find the problem.

karens’s picture

'node_page' is be a table created by CCK to hold field info for the 'page' content type. 'node_page.frm' would be one of the mysql files for that table. So something is wrong with that table, but there is no way to know what it is or why it happened without more info.

Knowing what that file is doesn't help me at all. Knowing what else is installed, what OS, php, CCK, and Drupal versions are being used and whether the problem exists if all other contrib modules are turned off would be much more helpful, which is why I asked those questions.

beginner’s picture

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

I tested with recently updated Drupal HEAD and content.module HEAD.
I started with a fresh install (new database).
After installing, I go to admin/content/types and I can update the type (machine-readable name) of both story and page (the two node types enabled by default).
I then enable content.module (i.e. only the base Drupal install + content.module), but if I repeat the same operation, I get the error mentioned above.

local setup:
linux mandriva,
php 4.4.0
mysql 4.0.26
Drupal HEAD (5.0-dev).

I have the same behavior on a remote server with the same configuration and module version but for mysql 4.1.11.

In the database, the node_page or node_story tables do not exist which is I believe is the reason of the problem.
When are they supposed to be created?

beginner’s picture

btw, I checked the updates: updates 1000 and 1001 of content.module are already done, and I have "no updates available" pre-selected.

karens’s picture

Thanks for the details. I'll try to follow these steps and see what is going on.

beginner’s picture

beginner’s picture

Title: Can't rename content type » Can't rename content type when tables use a prefix
Priority: Normal » Critical
karens’s picture

Status: Active » Fixed

I think the fixes just commited for http://drupal.org/node/112916 have fixed this, too. Reopen if not.

Anonymous’s picture

Status: Fixed » Closed (fixed)