SQL error on installation

goose2000 - June 13, 2007 - 14:15
Project:Node Relativity Access Control
Version:5.x-1.0
Component:Code
Category:bug report
Priority:critical
Assigned:Benjamin Melançon
Status:closed
Description

Upon copying the module folder over and activating the module check box and saving I'm getting this error:
(MySQL 5.0 , PHP 5.1)

* user warning: 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 'INDEX, uid int(10) unsigned NOT NULL default '0' )' at line 2 query: CREATE TABLE relativity_access ( nid int(10) unsigned NOT NULL default '0' INDEX, uid int(10) unsigned NOT NULL default '0' ); in C:\Inetpub\wwwroot\drupal\includes\database.mysql.inc on line 172.
* user warning: Table 'drupal5.relativity_access' doesn't exist query: SELECT * FROM relativity_access WHERE nid = 146 in C:\Inetpub\wwwroot\drupal\includes\database.mysql.inc on line 172.
* user warning: Table 'drupal5.relativity_access' doesn't exist query: SELECT * FROM relativity_access WHERE nid = 147 in C:\Inetpub\wwwroot\drupal\includes\database.mysql.inc on line 172.
* user warning: Table 'drupal5.relativity_access' doesn't exist query: SELECT * FROM relativity_access WHERE nid = 148 in C:\Inetpub\wwwroot\drupal\includes\database.mysql.inc on line 172.
* user warning: Table 'drupal5.relativity_access' doesn't exist query: SELECT * FROM relativity_access WHERE nid = 149 in C:\Inetpub\wwwroot\drupal\includes\database.mysql.inc on line 172.
* user warning: Table 'drupal5.relativity_access' doesn't exist query: SELECT * FROM relativity_access WHERE nid = 150 in C:\Inetpub\wwwroot\drupal\includes\database.mysql.inc on line 172.
* user warning: Table 'drupal5.relativity_access' doesn't exist query: SELECT * FROM relativity_access WHERE nid = 151 in C:\Inetpub\wwwroot\drupal\includes\database.mysql.inc on line 172.
* user warning: Table 'drupal5.relativity_access' doesn't exist query: SELECT * FROM relativity_access WHERE nid = 152 in C:\Inetpub\wwwroot\drupal\includes\database.mysql.inc on line 172.

#1

goose2000 - June 13, 2007 - 15:46

I have removed the section 'INDEX' from this table create command and it follows through now, installs. BUT...
Does INDEX work in MySQL5 ? I know what key is but what does index do?

Sorry for the dumb question.

#2

goose2000 - June 13, 2007 - 16:00

MySQL 5 manual :

"With col_name(N) syntax in an index specification, you can create an index that uses only the first N characters of a string column. Indexing only a prefix of column values in this way can make the index file much smaller. When you index a BLOB or TEXT column, you must specify a prefix length for the index. For example:

CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10)));"

So, looks like it is wrapped in (), I can't get it to work though. Anyway seems to be a performance thing, not function.

#3

smw - June 25, 2007 - 13:21
Priority:normal» critical

Yep, I get the same errors,

Does anyone know the SQL to create the tables that are missing here?

Or how to resolve this error, I have performed the update.php and the uninstall / reinstall a number of times now.

Why does this happen?

#4

Benjamin Melançon - August 17, 2007 - 01:06
Assigned to:Anonymous» Benjamin Melançon

Hey, sorry for being a horribly inattentive module maintainer. I thought this was set to e-mail me. I'll be getting to work on this.

#5

Benjamin Melançon - August 17, 2007 - 01:13

If the original posters are still there, do you know what version of MySQL you are using? Maybe I put MySQL5-only syntax in there.

#6

z.stolar - September 3, 2007 - 09:43
Title:bad install» SQL error on installation

I'm getting this error:

user warning: 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 'INDEX, uid int(10) unsigned NOT NULL default '0' )' at line 2 query: CREATE TABLE relativity_access ( nid int(10) unsigned NOT NULL default '0' INDEX, uid int(10) unsigned NOT NULL default '0' ); in /var/www/projects/bpn/includes/database.mysql.inc on line 172.

I'm using MySQL 5.0.22

#7

z.stolar - September 3, 2007 - 09:55

I think the INDEX keyword is misplaced.
Have you tried the following:

<?php
db_query
("CREATE TABLE {relativity_access} (
          nid int(10) unsigned NOT NULL default '0',
          uid int(10) unsigned NOT NULL default '0',
          KEY (uid),
        )"
);
?>

It worked for me. BTW, you had an unnecessary ";" at the end of the query (when using db_query, you don't need to terminate your queries with ";")

#8

Benjamin Melançon - September 5, 2007 - 15:59
Status:active» fixed

Release 5.x-1.3 should fix this-- and some other important things.

If you installed the module and the table creation errors have made it difficult to uninstall, this 1.3 version of the module will help:

If you have difficulty uninstalling a previous version, replace with this one first (but still do uninstall and then reinstall).

Sorry again about the rocky start, it should be usable now.

#9

Anonymous - September 19, 2007 - 16:12
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.