When adding an image gallery, this warning is returned:
user warning: Unknown column 'field_advgallery_nid' in 'field list' query: INSERT INTO drupal_content_field_advgallery (vid, nid, delta, field_advgallery_nid) VALUES (252, 220, 0, NULL) in .../sites/all/modules/cck/content.module on line 1213.

When entering the Edit Gallery tab, this warning is returned:
user warning: Unknown column 'ag.field_advgallery_nid' in 'on clause' query: SELECT DISTINCT(n.nid) AS nid, n.created, n.vid, n.title, ag.delta AS delta, f.fid, f.filename, f.filepath, f.filemime, f.filesize FROM drupal_node n INNER JOIN drupal_content_type_advimage ai ON n.nid=ai.nid AND n.vid=ai.vid INNER JOIN drupal_files f ON f.fid=ai.field_advimage_fid LEFT JOIN drupal_content_field_advgallery ag ON n.nid=ag.field_advgallery_nid LEFT JOIN drupal_node n1 ON n1.vid=ag.vid and n1.nid=ag.nid WHERE n.uid=1 AND n.type='advimage' AND (n1.nid IS NULL) ORDER BY n.created DESC LIMIT 0, 10 in .../sites/all/modules/advimage/advimage.edit.inc on line 486.

The table has a nid field, but not a field named field_advgallery_nid.

I'm not sure what the correct solution is, for example adding the field to the database (if that, how should it be defined?) or changing the code. Could you please advise?

Thank you. It looks like a very useful module, so I'm hoping to include it in a site due to be implemented in a few days.

Comments

Ilya1st’s picture

which cck version do you use?

Ilya1st’s picture

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 ') AND uid=1 AND type='advimage'' at line 1 query: SELECT nid FROM drgr_node WHERE nid in() AND uid=1 AND type='advimage' в файле /home/brainstorm/work/garmahis.ru/htdocs/sites/all/modules/advimage/advimage_ref/advimage_ref.module в строке 206.mysql> desc drgr_content_field_advgallery;
+----------------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+------------------+------+-----+---------+-------+
| vid | int(10) unsigned | NO | PRI | 0 | |
| nid | int(10) unsigned | NO | MUL | 0 | |
| delta | int(10) unsigned | NO | PRI | 0 | |
| field_advgallery_nid | int(10) unsigned | YES | MUL | NULL | |
+----------------------+------------------+------+-----+---------+-------+

on my installation there is there. may be some misconfiguration?

need more info

Ilya1st’s picture

Status: Active » Postponed (maintainer needs more info)

desc content_field_advgallery;
+----------------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+------------------+------+-----+---------+-------+
| vid | int(10) unsigned | NO | PRI | 0 | |
| nid | int(10) unsigned | NO | MUL | 0 | |
| delta | int(10) unsigned | NO | PRI | 0 | |
| field_advgallery_nid | int(10) unsigned | YES | MUL | NULL | |
+----------------------+------------------+------+-----+---------+-------+
4 rows in set (0.05 sec)

on a new fresh installation. it STANDARD nodereference CCK structure. I don't know what's wrong on your side.

The table has a nid field, but not a field named field_advgallery_nid.

Your CCK version? (I use latest stable). Also "show create table content_field_advgallery" in your mysql.

Also checkout 2.5 release - http://drupal.org/node/1199758

Do not test on -dev
There may be unstable code and drupal.org has some issues with rebuilding -dev packages

ailgm’s picture

Thanks for your quick responses. I have version 6.x-3.0-alpha3 of CCK installed.

Here's the create table statement:
CREATE TABLE `content_field_advgallery` (
`vid` int(10) unsigned NOT NULL default '0',
`nid` int(10) unsigned NOT NULL default '0',
`delta` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`vid`,`delta`),
KEY `nid` (`nid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

I've now installed release 2.5, which did not add the field to the table.

Could you perhaps give me the SQL to add the field and adjust any indexes it should be in?

Ilya1st’s picture

drop advimage and advgallery types and reinstall modules.

so we need add new issue about work with fields.

Ilya1st’s picture

Assigned: Unassigned » Ilya1st
Status: Postponed (maintainer needs more info) » Needs work

well.
understood whats wrong.

we must build queries(fields there) accordingly to database info from that's functions.

$schema = drupal_get_schema('content_field_advgallery');
$field = content_fields('field_advgallery');
$db_info = content_database_info($field);

so it's really a bug cause database structure can change as i see. that.
Thank you for your work.

Ilya1st’s picture

Category: bug » support
Status: Needs work » Closed (won't fix)

+----------------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+------------------+------+-----+---------+-------+
| vid | int(10) unsigned | NO | PRI | 0 | |
| nid | int(10) unsigned | NO | MUL | 0 | |
| delta | int(10) unsigned | NO | PRI | 0 | |
| field_advgallery_nid | int(10) unsigned | YES | MUL | NULL | |
+----------------------+------------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

just have tested CCK 3.0.
All structures are same as with 2.x
you're wrong there all works properly.

Bug invalid.

ailgm’s picture

Status: Closed (won't fix) » Active

Well, it didn't work properly for me, so in that sense I'm not wrong. I appreciate you trying to figure out why.

Working from your suggestion in #5 to drop the types and reinstall the modules, I did this:
- disable the modules
- uninstall the modules
- manually drop the three tables I saw in the database related to these modules: content_field_advgallery, content_type_advgallery and content_type_advimage
- re-enable the modules (many warnings then appeared) - specifically these three: advimage, advimage_up and advupload
- checked the database and found four (instead of three tables) -- an extra one I didn't have before: content_field_advimage, and found that the content_field_advgallery table was created with the additional field I didn't have before.

Now when I create a gallery and go to the Edit gallery tab, this warning appears:
user warning: Unknown column 'ai.field_advimage_fid' in 'on clause' query: SELECT DISTINCT(n.nid) AS nid, n.created, n.vid, n.title, ag.delta AS delta, f.fid, f.filename, f.filepath, f.filemime, f.filesize FROM node n INNER JOIN content_type_advimage ai ON n.nid=ai.nid AND n.vid=ai.vid INNER JOIN files f ON f.fid=ai.field_advimage_fid LEFT JOIN content_field_advgallery ag ON n.nid=ag.field_advgallery_nid LEFT JOIN node n1 ON n1.vid=ag.vid and n1.nid=ag.nid WHERE n.uid=1 AND n.type='advimage' AND (n1.nid IS NULL) ORDER BY n.created DESC LIMIT 0, 10 in .../sites/all/modules/advimage/advimage.edit.inc on line 486.

The create table statement for that table is:
CREATE TABLE `content_type_advimage` (
`vid` int(10) unsigned NOT NULL default '0',
`nid` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`vid`),
KEY `nid` (`nid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

Could you please look at this and let me know if you have a suggestion? Thanks.

Ilya1st’s picture

Status: Active » Closed (cannot reproduce)

As CCK 3.0 is not in stable status use 2.x for correct work.

The right nodereference structure is as I wrote before. And even with CCK 3.0 I could not reproduce you bug. It may depend on other modules you use in alpha or beta state :)

try drop content_type_advimage too/ try test modules on clean drupal distribution and see tables there

ailgm’s picture

Status: Closed (cannot reproduce) » Active

I've done as you suggested, installing this on another site with CCK 2.9 instead of 3.0.

Just as happened with the first installation, these database objects weren't created:
1) the table content_field_advimage
2) the column field_advgallery_nid in content_field_advgallery, and
3) the column field_advimage_fid in content_type_advimage

Could it be a matter of which modules I'm selecting within admin/build/modules, or that I'm enabling all of them simultaneously? For some reason, it seems that some of the SQL statements needed to set up the database aren't being executed.

Could you please provide the create table statements that are supposed to run for each table?

Ilya1st’s picture

Status: Active » Closed (cannot reproduce)

that are CCK standard structures created by CCK. all calls to create that types were added to advimage_install hook.
okay. looking on clear site.

show create table content_field_advgallery;
| content_field_advgallery | CREATE TABLE `content_field_advgallery` (
`vid` int(10) unsigned NOT NULL DEFAULT '0',
`nid` int(10) unsigned NOT NULL DEFAULT '0',
`delta` int(10) unsigned NOT NULL DEFAULT '0',
`field_advgallery_nid` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`vid`,`delta`),
KEY `nid` (`nid`),
KEY `field_advgallery_nid` (`field_advgallery_nid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

show create table content_type_advimage;
| content_type_advimage | CREATE TABLE `content_type_advimage` (
`vid` int(10) unsigned NOT NULL DEFAULT '0',
`nid` int(10) unsigned NOT NULL DEFAULT '0',
`field_advimage_fid` int(11) DEFAULT NULL,
`field_advimage_list` tinyint(4) DEFAULT NULL,
`field_advimage_data` text,
PRIMARY KEY (`vid`),
KEY `nid` (`nid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |

СCK 6.x-2.9
advimage latest stable.

What I'm doing wrong?

ailgm’s picture

Thanks. I added the last three fields (using an alter table statement) to content_type_advimage, and the error message no longer appears. Perhaps someone else can provide a reproducable case.

Ilya1st’s picture

adding images and other thing work properly?

ailgm’s picture

As per my posting in the advupload issue queue, now I've run into a Page not Found error uploading, so that's where I'm stuck now.

Ilya1st’s picture

Status: Closed (cannot reproduce) » Postponed
arturus-1’s picture

I have a similar problem, the tables do not create fields
1) field_advimage_fid (tables - photo_content_type_advimage)
2) field_advgallery_nid (tables - photo_content_field_advgallery)

I disabled modules:
Image 6.x-1.1
Image Attach 6.x-1.1

Disabled and deleted Advanced gallery

Reinstalled the module Advanced gallery

After this Advanced gallery established and is working normally

Ilya1st’s picture

Status: Postponed » Closed (cannot reproduce)