The latest dev version of Views seems to be messing everything up. I get an error saying
Column not found: 1054 Unknown column 'og_membership_og.type' in 'on clause'
when trying to add OG Membership relationship.

Might want to look into this.

CommentFileSizeAuthor
#3 og test view.zip1.2 KBnagiek

Comments

nagiek’s picture

Issue summary: View changes

typo

nagiek’s picture

Issue summary: View changes

ignore

nagiek’s picture

.

amitaibu’s picture

Status: Active » Postponed (maintainer needs more info)

Did you try with latest dev of Views and Entity as-well? Please attach an export of your view.

nagiek’s picture

StatusFileSize
new1.2 KB

View attached.

Yes, using the latest -dev versions of Entity, Views and OG.

Steps to reproduce:

  1. Fresh Install Drupal
  2. Instlal latest Ctools, Entity, Views and OG
  3. Make a content view
  4. Add relationship: Group: Node Group
  5. Add relationship: OG group: OG membership
  6. Get Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'og_membership_og.type' in 'on clause'

Been dealing with a lot of modules breaking because of latest Views -dev today (although it was the display style breaking, not relationships). But I'm sure it's related.

nagiek’s picture

Status: Postponed (maintainer needs more info) » Active
nagiek’s picture

Problem is actually Entity, not views.

You know how OG Membership uses "name" to define its bundle instead of "type", and there's inconsistent storage all over the place? Well, the new Entity just told us that's not good enough.

Clean up for this is probably going to be consistent storage and and a database column name change. :p

nagiek’s picture

Title: OG Membership Type from OG Membership views relationship incorrectly defined » OG incompatible with latest Entity release
nagiek’s picture

It's this new file: entity_views_handler_relationship_by_bundle.inc. Messing everything up.

tvilms’s picture

I've been struggling with a separate issue related to OG 7.x-1.3 the past couple of days (can't add or edit groups if the node is set to be a group type). However, in troubleshooting, I came across some behavior pointing at the OG ties to the Entity module.

When I started trying to unwind the OG problems, I tried uninstalling the OG modules to start from scratch. After I did, the related tables were gone from my database. But then after removing the OG modules from my sites/all/modules directory, my site then crashed on most links I tried. The PHP error log messages were pointing at the relationship with the entity module:

Class 'OgMetadataController' not found in /Applications/MAMP/htdocs/.../sites/all/modules/entity/entity.info.inc on line 23

and

Call to undefined function og_membership_type_access() in /Applications/MAMP/htdocs/.../sites/all/modules/entity/entity.module on line 427

Now, granted, this quirky behavior isn't "normal" because I'm uninstalling and doing other atypical admin work. But on the other hand these error messages are giving some additional insight into the OG - Entity integration points. Hope it helps.

rollingnet’s picture

This issue blocks every view that has a OG Membership relationship.

Waiting for a patch for this, at the moment anyone has tried to install old entity module in order to have views working again?

mradcliffe’s picture

Title: OG incompatible with latest Entity release » OG incompatible with latest Entity 7.x-1.0-beta11 release

@rollingnet: Yes, I have installed entity 1.0 b10 and og 1.3 as I did not have time myself to debug.

Edit: Changing issue title to be a bit more specific on the release number.

mradcliffe’s picture

The view handler relationship issue is due to a bug in entity. It assumes that the bundle column is always "type", which is not necessarily the case.

Edit:

This was fixed in entity commit a5f62e90af74e025126082302bbf51e5f9282e75.

rbruhn’s picture

After updating Entity I received this error when flushing the cache:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'og_membership_type_default' for key 'name': INSERT INTO {og_membership_type} (name, description, status, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => og_membership_type_default [:db_insert_placeholder_1] => Default [:db_insert_placeholder_2] => 2 [:db_insert_placeholder_3] => og ) in drupal_write_record() (line 6884 of C:\drupalt\public_html\includes\common.inc).

I tried applying the Entity fix above but that did not solve anything.
If I Empty the db table 'og_membership_type' and then flush, it ads the entry and works fine. If I try to flush the cache again I receive the error.

Edit: Just to be clear, I understand this is an issue with Entity. I went back to beta 10 and everything works

Taxoman’s picture

Is this also a problem with Entity RC1?
http://drupal.org/project/entity

rbruhn’s picture

I still receive the error I posted above when clearing cache with Entity RC1

mradcliffe’s picture

I am not sure if your issue is related, @rbruhn. I received the same error upgrading an earlier version of entity and og about 2 months ago. I did exactly what you did and it was fixed. Do you have any database updates in Og or Entity pending? I think you need to open a different issue.

The entity-1.0-b11 issue however is fixed in 1.0-rc1. Entity is behaving properly with Og now.

minoroffense’s picture

I'm using RC1 with Views and I get the following error #1345010: Organic Groups relationship causes - Fatal error: Call to a member function label() on a non-object

I was directed here since it was believed to be the same issue causing this error.

---------------------
UPDATED: Fixed issue reference

mradcliffe’s picture

@minorOffense: Iog_membership entity provides a label (this is valid) so this is an issue with entity api assuming it does have a label.

It's either Entity API's business to know better or Og's to provide an exception in its views data.

Taxoman’s picture

Title: OG incompatible with latest Entity 7.x-1.0-beta11 release » OG incompatible with latest Entity 7.x release

Lets avoid the specific version number in the title, this seems to appy to RC1 now, too.

Taxoman’s picture

Marked #1356784: OG incompability with Entity API 7.x-1.0-rc1 as a duplicate of this issue. There is a full error log printout over there.

mrfelton’s picture

I had this with latest og dev and Entity RC1 . I just upgraded Entity to latest dev, cleared the cache, and it seems to have resolved the issue.

Taxoman’s picture

Version: 7.x-1.x-dev » 7.x-1.1-rc1
amitaibu’s picture

@Taxoman, why did you set version to rc1 - am I missing something?

Taxoman’s picture

Version: 7.x-1.1-rc1 » 7.x-1.x-dev

Because #20 indicates that this is fixed in the latest dev, so it might be relevant only for one of the RC's..., but then of course that is the latest ENTITY dev, I did not pay attention to which queue this issue is in. Perhaps this is solved by using both dev versions. Should it be moved over to the Entity project?

blackclover’s picture

I'm using the latest devs and still getting the error
Entity API 7.x-1.x-dev (2011-Dec-06)
Organic groups 7.x-1.x-dev (2011-Dec-05)

nagiek’s picture

Priority: Normal » Critical

marking as critical since OG doesn't work in its present state.

amitaibu’s picture

Priority: Critical » Major

> marking as critical since OG doesn't work in its present state.

We are talking about the Views integration, no? Would be nice if someone that got the error would do some debugging..

blackclover’s picture

Drupal db update generates the warning error below and the debug error appears when you access a view with og membership relationships

Pending updates:
og module
7101 - Rename the 'name' column to 'type' in {OG membership}.
7102 - Add default value function to all audience field instances.

Warning:
Notice: Undefined index: label in entity_views_field_definition() (line 165 of /Applications/MAMP/htdocs/e_deliberation/sites/all/modules/entity/views/entity.views.inc).

Debug:
'Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column \'og_membership_og.name\' in \'on clause\''

in views_plugin_query_default->execute() (line 1386 of /Applications/MAMP/htdocs/e_deliberation/sites/all/modules/views/plugins/views_plugin_query_default.inc).

Hope this helps

amitaibu’s picture

Pending updates:
og module
7101 - Rename the 'name' column to 'type' in {OG membership}.
7102 - Add default value function to all audience field instances.

I see there are pending updated -- did you execute update.php? Did you try to disable views before executing update.php?

blackclover’s picture

Yes I did run update. The error occurs after running it. No I didn't try that.

blackclover’s picture

The warning is from update.php and the Debug is when accessing a page with an og-membership view on it after running update.

amitaibu’s picture

@blackclover,
Is it a dev site? Can you attach a db dump so I can test it -- if so, please disable everything not related to the issue.

blackclover’s picture

Sorry for some reason my dashboard did not indicate that you responded.
It's a production site with a very large number of contributed modules. I was gonna set it up on my local test environment but thought I would just try the latest dev of views first. The error does not occur with the newest dev of views. I installed the latest og and views at the same time and it worked great. Tried another scenario where I installed the new views after I updated OG (got the same error with existing views). Error went away with new views installed.

Unfortunately the new views has another issue http://drupal.org/node/1375254 that isn't groups related.

Taxoman’s picture

Is this still a problem with the latest releaseS of OG (1.4) and also Entity (RC2)?
Edit: and on the newly released D7.13/.14?

escore’s picture

Yesterdays update of OG to 1.4 appears to cause the same problem again, breaking all pages with views with a OG membership relationship. Entity is v 7.x-1.0-rc2, which worked with the previous version of OG. After reading the thread above I couldn't identify a reliable workaround or fix. Did I miss something?

Error message:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'og_membership.type' in 'field list': SELECT og_membership.id AS entity_id, og_membership.type AS bundle, :entity_type AS entity_type, NULL AS revision_id FROM {og_membership} og_membership WHERE (og_membership.entity_type = :db_condition_placeholder_0) AND (og_membership.etid = :db_condition_placeholder_1) AND (og_membership.state IN (:db_condition_placeholder_2)) ; Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => 8096 [:db_condition_placeholder_2] => 1 [:entity_type] => og_membership ) in EntityFieldQuery->execute() (line 1136 of /var/www/thesite/includes/entity.inc).

escore’s picture

Yesterdays update of OG to 1.4 appears to cause the same problem again, breaking all pages with views with a OG membership relationship (which is most on my site). Entity is v 7.x-1.0-rc2, which worked with the previous version of OG. After reading the thread above I couldn't identify a reliable workaround or fix. Did I miss something?

Error message:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'og_membership.type' in 'field list': SELECT og_membership.id AS entity_id, og_membership.type AS bundle, :entity_type AS entity_type, NULL AS revision_id FROM {og_membership} og_membership WHERE (og_membership.entity_type = :db_condition_placeholder_0) AND (og_membership.etid = :db_condition_placeholder_1) AND (og_membership.state IN (:db_condition_placeholder_2)) ; Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => 8096 [:db_condition_placeholder_2] => 1 [:entity_type] => og_membership ) in EntityFieldQuery->execute() (line 1136 of /var/www/thesite/includes/entity.inc).

[EDIT] Group nodes display the same error, so it may not be related to views. My failing views also contained a "OG group from Node" relationship.

Taxoman’s picture

- and today Drupal 7.13 will be released...

escore’s picture

Ignore my post, I failed to run the database updates. Now everything is ok.

CatherineOmega’s picture

I'm still seeing this problem on Drupal 7.14, OG 7.x-1.4 and Entity (RC2). It wasn't showing up on Drupal 7.14, OG 7.x-1.3. Ideas?

rbruhn’s picture

Ran into this problem again when updating my local site. Using Drupal 7.14, OG 7.x-1.4, Entity 7.x-1.0-rc3.
It results in this error:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'og_membership.type' in 'field list': SELECT og_membership.id AS entity_id, og_membership.type AS bundle, :entity_type AS entity_type, NULL AS revision_id FROM {og_membership} og_membership WHERE (og_membership.entity_type = :db_condition_placeholder_0) AND (og_membership.etid = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => 1236 [:entity_type] => og_membership ) in EntityFieldQuery->execute() (line 1139 of E:\drupal.loc\public_html\includes\entity.inc).

Inside a View for solr index :
1) choose add a field
2) select Indexed Node from the Filter drop down
3) select Indexed Node: Group memberships (A list of all group memberships of the Node entity.)
4) click apply (this display)
An ajax error usually pops up by then.

I'm using Search_Api with SOLR and created a "browse" View for the solr index. I thought perhaps the "Group memberships" field needed to be indexed in solr, so went to add it, and then tried to reindex. While trying to reindex solr the above error appeared again. So can't even add Group Membership to the index.

Any ideas why this is happening? It's really preventing me from going any further with my development.

Edit: I should mention this was working with Drupal 7.12 and earlier versions of OG and Entity. It just appeared again with my updating.

Edit2: I checked my database and the existing updates for OG. Apparently, the database updates never ran even though I did the updating through Drupal. I ran the database updates by hand and everything is working now.

johaziel’s picture

Hi,

I got the same error.
I changed the column "name" to "type" in the table "og_membership"
and now it works...

Regards

colinafoley’s picture

#40, did you mean you changed the column from "type" to "name"?

This also fixed the issue for me locally, but I'm not sure what other issues making this change might cause because that column might be accessed as "type" somewhere else in the og modules.

I have to review the updates that #39 mentioned.

misthero’s picture

changing the column name from "type" to "name" solve the view issue but throws other errors, logged in users get:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'og_membership.type' in 'field list': SELECT og_membership.id AS entity_id, og_membership.type AS bundle, :entity_type AS entity_type, NULL AS revision_id FROM {og_membership} og_membership WHERE (og_membership.entity_type = :db_condition_placeholder_0) AND (og_membership.etid = :db_condition_placeholder_1) AND (og_membership.state IN (:db_condition_placeholder_2)) ; Array ( [:db_condition_placeholder_0] => user [:db_condition_placeholder_1] => 0 [:db_condition_placeholder_2] => 1 [:entity_type] => og_membership ) in EntityFieldQuery->execute()

amitaibu’s picture

Status: Active » Closed (cannot reproduce)

It works fine. You probably need to run update.php and execute the Migrate plugins.

amitaibu’s picture

Issue summary: View changes

retitled