Posted by spydmobile on July 2, 2009 at 3:15pm
| Project: | Image FUpload |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | schema |
Issue Summary
Installing this on a live postgres fails to to bad syntax on INT - using INT(10) does not work. This has been addressed before in previous versions but for some reason it is still an issue.
Here are the errors:
warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "(" LINE 3: uid int(10) NOT NULL default 0, ^ in /var/www/sparcs/includes/database.pgsql.inc on line 139.
user warning: query: CREATE TABLE fupload_previewlist ( fieldname varchar(32) NOT NULL default '', uid int(10) NOT NULL default 0, nid int(10) NOT NULL default 0, fid int(11) default 0, created int(11) NOT NULL default 0, PRIMARY KEY (fid) ) in /var/www/sparcs/includes/database.inc on line 515.
warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "fupload_previewlist" does not exist in /var/www/sparcs/includes/database.pgsql.inc on line 139.
user warning: query: CREATE INDEX fupload_previewlist_fieldname_idx ON fupload_previewlist (fieldname) in /var/www/sparcs/includes/database.inc on line 515.
warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "fupload_previewlist" does not exist in /var/www/sparcs/includes/database.pgsql.inc on line 139.
user warning: query: CREATE INDEX fupload_previewlist_uid_idx ON fupload_previewlist (uid) in /var/www/sparcs/includes/database.inc on line 515.
There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately! See the available updates page for more information.removing the (10) sizes solved it for me, or perhaps using the tiny, big etc conventions.
this worked for me:
CREATE TABLE fupload_previewlist ( fieldname varchar(32) NOT NULL default '', uid int NOT NULL default 0, nid int NOT NULL default 0, fid int default 0, created int NOT NULL default 0, PRIMARY KEY (fid));
CREATE INDEX fupload_previewlist_fieldname_idx ON fupload_previewlist (fieldname) ;
CREATE INDEX fupload_previewlist_uid_idx ON fupload_previewlist (uid) ;
Comments
#1
Thank you for the detailed report.
#2
Hello,
As described in http://api.drupal.org/api/group/schemaapi/6 the 'field' attribute in hook_schema() should only be used for types varchar and text. In the image_fupload module I found it defined for int also.
I removed the field attributes in this (quick) patch. I tested it on my installation: drupal 6.13 with a postgresql database. I tested only once and not on a clean installation.
I think it is a bug in the core also. The referenced page says the field attribute is ignored for other types than varchar and text, but that is not true (http://api.drupal.org/api/function/_db_create_field_sql/6).
Hope this helps,
Ron
#3
base FUpload + FUpload cck
with MySQL 5 and the Schema module 6.x-1.6
admin/build/schema shows:
*fupload_previewlist
o column uid - difference on: length
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'length' => '10', 'not null' => TRUE, 'default' => 0)
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0)
o column nid - difference on: length
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'length' => '10', 'not null' => TRUE, 'default' => 0)
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0)
o column fid - differences on: not null, length
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'length' => '11', 'not null' => FALSE, 'default' => 0)
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0)
o column created - difference on: length
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'length' => '11', 'not null' => TRUE, 'default' => 0)
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0)
I do not know if it is related. I am asking me if the same patch can be applied?
#4
also another error with fid and index
fixed with this patch
#5
i have tested this patch and it´s works without problems. Thanks to User
#6
Thanks to all. Now committed to HEAD.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.
#8
Adding the schema tag...
#9
With MySQL 5 I still observ this:
fupload_previewlist
column fid - difference on: not null
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, 'default' => 0)
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0)
I took the version in dev which I understand should contain the proposed patch.