After sending a newsletter manually cron reports the following error message:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'target_id_tids' in 'where clause': SELECT * FROM {field_data_field_newsletter_list} WHERE field_newsletter_list_target_id = :lid AND target_id_tids IS NOT NULL; Array ( [:lid] => 3 ) in NewsletterMail->getNodes() (Zeile 138 von /is/htdocs/wp10606582_4DZYNM0HHG/www/knowledgeandtrends.de/sites/all/modules/newsletter/includes/newsletter.mail.inc).

When trying to edit a subscriber I get the following error message:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'target_id_tids' in 'field list': SELECT target_id_tids FROM {field_data_field_newsletter_list} WHERE entity_id = :nsid AND field_newsletter_list_target_id = :nlid; Array ( [:nsid] => 3 [:nlid] => 2 ) in newsletter_get_default_exposed() (Zeile 231 von /is/htdocs/wp10606582_4DZYNM0HHG/www/knowledgeandtrends.de/sites/all/modules/newsletter/includes/newsletter.functions.inc).

I am just trying to set up the newsletter module so maybe I made a mistake (but tried to follow your instructions). Any help would be great - because this module seems to cover my requirements perfectly.

Comments

ParisLiakos’s picture

can you check your database, if the table field_data_field_newsletter_list has the collumn target_id_tids?

are you using mysql?if not, which one?

goetz2’s picture

Thanks for your very fast response; yes, I am using MySQL ... and the table you mentioned does not have a field named target_id_tids; it has the following fields:
entity_type,bundle,deleted,entity_id,revision_id,language,delta,field_newsletter_list_target_id,field_newsletter_list_target_type

ParisLiakos’s picture

something went bad in the installation:/

when did you installed this module?
is it a long time ago?

if you disable , uninstall and then reisntall the module, does it work?
( be aware that you will lose your newsletter data if u uninstall..so if you have any subscribers backup your database first )

goetz2’s picture

I installed it yesterday - but just followed your advice, deactivation, deinstallation, new installation. The field target_id_tids is now in the table ;-))
Unfortunately I get a new error message when running cron:
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 ')) AND ((list.last_sent < node.created) OR (list.last_sent IS NULL )) ORDER BY ' at line 3: SELECT DISTINCT tax.nid AS nid, node.created AS created FROM {taxonomy_index} tax INNER JOIN {newsletter_list} list ON list.nlid = 1 INNER JOIN {node} node ON tax.nid = node.nid WHERE (tax.tid IN ()) AND ((list.last_sent < node.created) OR (list.last_sent IS NULL )) ORDER BY created DESC; Array ( ) in NewsletterMail->getNodes() (Zeile 146 von /is/htdocs/.../sites/all/modules/newsletter/includes/newsletter.mail.inc)
Thanks in advance for your advice!!! I really appreciate it

ParisLiakos’s picture

this is a known bug,i will roll out a new release in a while that has the fix..
but i have to investigate how your installation missed the target_id_tids field, i hope i can reproduce it

ParisLiakos’s picture

Title: Error when editing subsciber and during cron » target_id_tids field not populating during install
Version: 7.x-1.0-beta5 » 7.x-1.x-dev
goetz2’s picture

Thanks a lot

ParisLiakos’s picture

Status: Active » Closed (cannot reproduce)

cant reproduce it,and noone else seems to have this problem,so closing it

yeaha’s picture

Hi, i had the same basic error of 'Column not found: 1054 Unknown column 'target_id_tids' in 'where clause'" it seems like the newsletter_schema_alter() function did not execute during installation.

ParisLiakos’s picture

did reinstalling fixed it?
anything that could assist reproducing this?

i must add a test on this asap

yeaha’s picture

reinstalling fixed it indeed, don't know how to reproduce this

Robin Millette’s picture

I had the last release installed. Then I saw all the interesting commits and updated to latest dev.

The function responsible for adding the target_id_tids column is in the .install:

function newsletter_schema_alter(&$schema)

But it's never called from any of the newsletter_update hooks.

Disabling, uninstalling and reenabling the module worked.

Robin Millette’s picture

Status: Closed (cannot reproduce) » Active
ParisLiakos’s picture

Hello Robin.
It is called in hook_install()
Should i also call it on every hook_update() as well?

Robin Millette’s picture

What's called hook_install() ?

One of the newsletter_update_71XX() function should alter the schema.

For more info, see

ParisLiakos’s picture

function newsletter_install lines 53-61

   // Add extra collumn to handle exposed newsletter lists tids.
   newsletter_schema_alter($schema);
   foreach ($schema['field_data_field_newsletter_list']['fields'] as $name => $spec) {
     db_add_field('field_data_field_newsletter_list', $name, $spec);
   }

and it is there since beta1 iirc

milos.kroulik’s picture

Sadly, reinstalling didn't help in my case. I recorded error at:

http://youtu.be/bLj_p2jTMSE

Could you, please, provide SQL, which I can try to correct the database?

wolfram’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta8

i can reproduce it
7.x-1.0-beta8 on a drupal 7.15 like this:

to solve the problem mentioned in http://drupal.org/node/1724112
you have to resave some fields

after the installation of 7.x-1.0-beta8
in the table "field_data_field_newsletter_list" the collumn "target_id_tid" is there

after resave:
admin/config/media/newsletter/subscribers/fields
field_newsletter_list -> edit/save

the collumn "target_id_tid" in the same table gets lost

in my tests it doesn't matter if you apply patch #4 in http://drupal.org/node/1724112 or not
the colume gets lost

ParisLiakos’s picture

Thats weird, i just tried and collumn remains there.
wolfram are you on mysql?