PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal7.taxonomy_vocabulary_node_type' doesn't exist: SELECT v.name, v.vid FROM {taxonomy_vocabulary} v LEFT JOIN {taxonomy_vocabulary_node_type} t ON t.vid=v.vid WHERE t.type=':type'; Array ( [0] => article ) in indexpage_page_index() (line 223 of C:\www\webapps\drupal7\sites\all\modules\indexpage\indexpage.module).

I just did a fresh CVS update and rebuilt my site.

Comments

nancydru’s picture

Taxonomy.install does not include a schema definition for "taxonomy_vocabulary_node_type."

bojanz’s picture

Priority: Critical » Normal

As far as I know, taxonomy_vocabulary_node_type was removed during the move to Field API (I'm looking at this)

nancydru’s picture

Category: bug » support

So how in the heck do you find which vocabularies are used by a specified content type? Several contribs are going to have to know how to do this.

aaronbauman’s picture

Vocabularies are now handled as fields.
Content types are associated with vocabularies via Fields API.

nancydru’s picture

Thanks for the response, but it doesn't answer the question. For example, in D6, one can write taxonomy_get_vocabularies('story') to find all the vocabularies that are used by the "story" content type. How does one do that in D7?

aaronbauman’s picture

Check field_info_fields():

$fields = field_info_fields();
$story_vocabs = array();
foreach ($fields as $field_name => $field) {
  if (!empty($field['bundles']['node']) && $field['type'] == 'taxonomy_term_reference' && in_array('story', $field['bundles']['node'])) {
    $story_vocabs[] = $field['settings']['allowed values'][0]['vid'];
}
nancydru’s picture

Thanks, I will give it a try.

berdir’s picture

I guess it would make sense to add the above code snippet to http://drupal.org/node/224333#taxonomy_node?

nancydru’s picture

It is "allowed_values". In case someone else who needs it, here is what I changed it to that gives basically the same result as the D6 taxonomy_get_vocabularies('article')

  $fields = field_info_fields();
  $vocabs = array();
  foreach ($fields as $field_name => $field) {
    if (!empty($field['bundles']['node']) && $field['type'] == 'taxonomy_term_reference' && in_array('article', $field['bundles']['node'])) {
      $vid = $field['settings']['allowed_values'][0]['vid'];
      $vocabs[$vid] = taxonomy_vocabulary_load($vid);
    }
  }
aaronbauman’s picture

Status: Active » Fixed

I added the snippet from #6 to http://drupal.org/node/224333#taxonomy_node

Please feel free to update!

nancydru’s picture

I corrected the allowed_values typo.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

inti2010’s picture

Category: support » bug
Status: Closed (fixed) » Needs work

Just installed v7 on my local machine using Wamp v2.1
PHP 5.3.5
MySQL 5.5.8
There is no table?
Is there a patch? Let me rephrase.
Where do I put this patch?

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* taxonomy_vocabulary' at line 1: SELECT name, machine_name, vid FROM * {taxonomy_vocabulary}; Array ( ) in taxonomy_vocabulary_get_names() (line 791 of C:\wamp21\www\drupal7\modules\taxonomy\taxonomy.module).

inti2010’s picture

Just installed v7 on my local machine using Wamp v2.1
PHP 5.3.5
MySQL 5.5.8
There is no table?
Is there a patch? Let me rephrase.
Where do I put this patch?

bojanz’s picture

Status: Needs work » Closed (fixed)

There is no patch and there isn't anything to put anywhere. Things just work differently now, see #9.

It looks like you're having a different problem, so open a new issue.

inti2010’s picture

Thanks!
I just did a total re-install (this just took 4 hours) but I now have Taxonomy on localhost!
And I swear I did nothing different except install the minimal version then add stuff.
Drupal will try the patients of a saint.

cyberranger’s picture

Do we make the change in #9 to indexpage.module around line 225? I've tried

$fields = field_info_fields();
  $vocabs = array();
  foreach ($fields as $field_name => $field) {
    if (!empty($field['bundles']['node']) && $field['type'] == 'taxonomy_term_reference' && in_array('article', $field['bundles']['node'])) {
      $vid = $field['settings']['allowed_values'][0]['vid'];
      #$vocabs[$vid] = db_query("SELECT name FROM {taxonomy_vocabulary} WHERE vid = :vid", array(':vid' => $vid))->fetchField();
      $vocabs[$vid] = taxonomy_vocabulary_load($vid);
    }
  }

that but now I'm getting -

Notice: Undefined index: vid in indexpage_page_index() (line 253 of /var/www/html/sites/all/modules/indexpage/indexpage.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /var/www/html/includes/entity.inc).
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ncmb.taxonomy_vocabulary_node_type' doesn't exist: SELECT n.nid, v.name FROM {node} n JOIN {taxonomy_index} tn ON tn.nid=n.nid JOIN {taxonomy_term_data} td ON td.tid=tn.tid JOIN {taxonomy_vocabulary} v ON v.vid=td.vid LEFT JOIN {taxonomy_vocabulary_node_type} nt ON nt.vid=v.vid AND nt.type=n.type WHERE n.type=':type' AND nt.type IS NULL; Array ( [:type] => wikicm ) in indexpage_page_index() (line 315 of /var/www/html/sites/all/modules/indexpage/indexpage.module).