SQL error on installation
| Project: | Node Relativity Access Control |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Benjamin Melançon |
| Status: | closed |
Jump to:
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
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
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
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
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
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
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
I think the INDEX keyword is misplaced.
Have you tried the following:
<?phpdb_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
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:
Sorry again about the rocky start, it should be usable now.
#9