Обсуждение: BUG #9278: Error: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is ambiguous LINE 8: ...
BUG #9278: Error: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is ambiguous LINE 8: ...
От
tonimueller.unihalle@gmail.com
Дата:
The following bug has been logged on the website: Bug reference: 9278 Logged by: Toni Müller Email address: tonimueller.unihalle@gmail.com PostgreSQL version: 9.1.0 Operating system: Ubuntu 13.10 Description: Hello PostgreSQL developers, there is an unsolved bug probably in PostgreSQL which from 2010 still persists in combination with Drupal7 and its Taxonomy module (7.26) if you want to create a Tag Cloud based on Taxonomy terms. This issue doesn't exist with MySQL. In Drupal7 I created a view for a tag cloud in drupal 7 based on Taxonomy terms (Module Taxonomy 7.26). The problem is to add the Field '(node) COUNT(Content: Nid)' with Count Aggregation type to count all terms and display equal terms as one representative with the account of one term's sum. With this field the following error appears already in the view settings: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is ambiguous LINE 8: ... taxonomy_term_data_name, taxonomy_term_data_vid, tid, taxon... ^ The view itself can't be displayed as block and Tag cloud, respectively only if the Field '(node) COUNT(Content: Nid)' is added. I believe that the best Open Source database can count! ;-) It would be great if PostgreSQL and taxonomy module experts could fix this issue. Thank you! Best wishes, Toni PS: View Export code: $view = new view(); $view->name = 'tags_cloud'; $view->description = 'Taxonomy tags cloud block (with counter)'; $view->tag = 'default'; $view->base_table = 'taxonomy_term_data'; $view->human_name = 'Tags cloud'; $view->core = 7; $view->api_version = '3.0'; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ /* Display: Master */ $handler = $view->new_display('default', 'Master', 'default'); $handler->display->display_options['title'] = 'Tags'; $handler->display->display_options['use_more_always'] = FALSE; $handler->display->display_options['group_by'] = TRUE; $handler->display->display_options['access']['type'] = 'perm'; $handler->display->display_options['cache']['type'] = 'none'; $handler->display->display_options['query']['type'] = 'views_query'; $handler->display->display_options['query']['options']['query_comment'] = FALSE; $handler->display->display_options['exposed_form']['type'] = 'basic'; $handler->display->display_options['pager']['type'] = 'full'; $handler->display->display_options['pager']['options']['items_per_page'] = '200'; $handler->display->display_options['pager']['options']['offset'] = '0'; $handler->display->display_options['pager']['options']['id'] = '0'; $handler->display->display_options['pager']['options']['quantity'] = '9'; $handler->display->display_options['style_plugin'] = 'default'; $handler->display->display_options['row_plugin'] = 'fields'; /* Relationship: Taxonomy term: Content with term */ $handler->display->display_options['relationships']['nid']['id'] = 'nid'; $handler->display->display_options['relationships']['nid']['table'] = 'taxonomy_index'; $handler->display->display_options['relationships']['nid']['field'] = 'nid'; $handler->display->display_options['relationships']['nid']['group_type'] = 'count'; /* Field: Taxonomy term: Name */ $handler->display->display_options['fields']['name']['id'] = 'name'; $handler->display->display_options['fields']['name']['table'] = 'taxonomy_term_data'; $handler->display->display_options['fields']['name']['field'] = 'name'; $handler->display->display_options['fields']['name']['label'] = ''; $handler->display->display_options['fields']['name']['alter']['word_boundary'] = FALSE; $handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE; $handler->display->display_options['fields']['name']['link_to_taxonomy'] = TRUE; /* Field: COUNT(Content: Nid) */ $handler->display->display_options['fields']['nid']['id'] = 'nid'; $handler->display->display_options['fields']['nid']['table'] = 'node'; $handler->display->display_options['fields']['nid']['field'] = 'nid'; $handler->display->display_options['fields']['nid']['relationship'] = 'nid'; $handler->display->display_options['fields']['nid']['group_type'] = 'count'; $handler->display->display_options['fields']['nid']['label'] = ''; $handler->display->display_options['fields']['nid']['alter']['alter_text'] = TRUE; $handler->display->display_options['fields']['nid']['alter']['text'] = '([nid])'; /* Filter criterion: Taxonomy vocabulary: Machine name */ $handler->display->display_options['filters']['machine_name']['id'] = 'machine_name'; $handler->display->display_options['filters']['machine_name']['table'] = 'taxonomy_vocabulary'; $handler->display->display_options['filters']['machine_name']['field'] = 'machine_name'; $handler->display->display_options['filters']['machine_name']['value'] = array( 'all' => 'all', 'tags' => 'tags', 'world' => 'world', ); $handler->display->display_options['filters']['machine_name']['group'] = '0'; /* Display: Tags */ $handler = $view->new_display('block', 'Tags', 'block'); $handler->display->display_options['display_description'] = 'Tags cloud'; $handler->display->display_options['defaults']['hide_admin_links'] = FALSE; $handler->display->display_options['defaults']['use_more'] = FALSE; $handler->display->display_options['use_more'] = TRUE; $handler->display->display_options['defaults']['use_more_always'] = FALSE; $handler->display->display_options['defaults']['use_more_always'] = FALSE; $handler->display->display_options['use_more_always'] = TRUE; $handler->display->display_options['defaults']['use_more_text'] = FALSE; $handler->display->display_options['use_more_text'] = 'More'; $handler->display->display_options['defaults']['pager'] = FALSE; $handler->display->display_options['pager']['type'] = 'some'; $handler->display->display_options['pager']['options']['items_per_page'] = '40'; $handler->display->display_options['pager']['options']['offset'] = '0'; $handler->display->display_options['block_description'] = 'Tags cloud'; /* Display: Page */ $handler = $view->new_display('page', 'Page', 'page_1'); $handler->display->display_options['defaults']['hide_admin_links'] = FALSE; $handler->display->display_options['path'] = 'tags'; Thank you very much for your support. tonimueller.unihalle@gmail.com
tonimueller.unihalle wrote > The following bug has been logged on the website: >=20 > Bug reference: 9278 > Logged by: Toni M=C3=BCller > Email address: =20 > tonimueller.unihalle@ > PostgreSQL version: 9.1.0 > Operating system: Ubuntu 13.10 > Description: =20 >=20 > Hello PostgreSQL developers,=20 >=20 > there is an unsolved bug probably in PostgreSQL which from 2010 still > persists in combination with Drupal7 and its Taxonomy module (7.26) if yo= u > want to create a Tag Cloud based on Taxonomy terms. This issue doesn't > exist > with MySQL.=20 > In Drupal7 I created a view for a tag cloud in drupal 7 based on Taxonomy > terms (Module Taxonomy 7.26). The problem is to add the Field '(node) > COUNT(Content: Nid)' with Count Aggregation type to count all terms and > display equal terms as one representative with the account of one term's > sum. With this field the following error appears already in the view > settings:=20 > SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is > ambiguous LINE 8: ... taxonomy_term_data_name, taxonomy_term_data_vid, > tid, > taxon... ^ I am doubting that PostgreSQL is reporting an ambiguous column error when there is none so this is likely not something that PostgreSQL can "fix".=20 Regardless, we'd be happy to look at it but you provide insufficient detail and scope-restriction (i.e., self-contained and minimal query/script that reproduces the error) for anyone not using the exact combination of softwar= e you list to actually evaluate the complaint. Maybe someone who monitors this list can help but if you haven't already yo= u need to either provide considerably more detail or convince the authors of the Taxonomy module to do so. At a bare minimum we need the entire SQL statement that is being sent to the server. You also claim that this "bug" likely exists since 2010. What evidence makes you think that? Supposedly there was an report of a problem back the= n as well...and if so it would be helpful if you would actually provide a lin= k to such. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-9= 278-Error-SQLSTATE-42702-Ambiguous-column-7-ERROR-column-reference-tid-is-a= mbiguous-LINE-8-tp5792736p5792745.html Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.
On Thu, Feb 20, 2014 at 1:49 AM, <tonimueller.unihalle@gmail.com> wrote: > SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is > ambiguous LINE 8: ... taxonomy_term_data_name, taxonomy_term_data_vid, tid, > taxon... ^ I am not seeing any bug here. This error is usually found because of some bad naming in queries involving joins like this one: =# create table aa (tid int); CREATE TABLE =# create table bb (tid int); CREATE TABLE =# select tid from aa,bb where aa.tid = bb.tid; ERROR: 42702: column reference "tid" is ambiguous LINE 1: select tid from aa,bb where aa.tid = bb.tid; ^ LOCATION: colNameToVar, parse_relation.c:612 You should complete the SELECT clause with some alias like that: =# select aa.tid from aa,bb where aa.tid = bb.tid; tid ----- (0 rows) Or that: =# select bb.tid from aa,bb where aa.tid = bb.tid; tid ----- (0 rows) Regards, -- Michael