Project

General

Profile

Actions

Bug #29783

closed

getQuery: fields explicilty added on select <table>.* : Error: ambigious parameter uid

Added by Björn Pedersen over 12 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2011-10-11
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
TYPO3 Version:
4.6
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

tslib_content->getQuery add ui and pid to the selected fields if fields are set. It does not check, wether a tablename.* occurs.

That occurs e.g. using cal_ts_service to link seminars events to cal calenders. There the query needs to contain table.title as mytitle.

Solution: Check, if a * is part of the requested fields.


Subtasks 1 (0 open1 closed)

Task #30762: Add Unit tests for #29783Rejected2011-10-11

Actions

Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #17284: no content in workspace preview when using select.selectFieldsClosedBenni Mack2007-05-07

Actions
Related to TYPO3 Core - Bug #34152: stdWrap function numRows() fails in 4.6 due to wrong SELECT clauseClosedErnesto Baschny2012-02-21

Actions
Has duplicate TYPO3 Core - Bug #30486: Typoscript select join brokenClosed2011-09-30

Actions
Actions #1

Updated by Mr. Hudson over 12 years ago

Patch set 1 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #2

Updated by Mr. Hudson over 12 years ago

Patch set 2 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #3

Updated by Mr. Hudson over 12 years ago

Patch set 3 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #4

Updated by Tobias Liebig over 12 years ago

  • Category set to Database API (Doctrine DBAL)
  • Status changed from New to Under Review
  • Assignee set to Björn Pedersen
Actions #5

Updated by Björn Pedersen over 12 years ago

The TS from cal_ts_service:

plugin.tx_cal_controller {
        display {
                seminars {

                        # @description  This is the heart of the connection SQL. It will be used in conjunction with 
                        #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records.
                        event_select {
                                selectFields = tx_seminars_seminars.*, tx_seminars_timeslots.*, tx_seminars_timeslots.begin_date as bgndt, tx_seminars_timeslots.end_date as nddt, tx_seminars_seminars.title as mytitle, tx_seminars_timeslots.begin_date as my_startdate, tx_seminars_timeslots.end_date as my_enddate
                                leftjoin = tx_seminars_timeslots ON (tx_seminars_seminars.uid=tx_seminars_timeslots.seminar)
                        }

}

Actions #6

Updated by Mr. Hudson over 12 years ago

Patch set 4 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #7

Updated by Helmut Hummel over 12 years ago

  • Status changed from Under Review to Accepted
  • Priority changed from Should have to Must have
  • Target version set to 4.6.0-RC1

This needs to be resolved in RC1 or #17284 must be reverted.

Actions #8

Updated by Mr. Hudson over 12 years ago

Patch set 5 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #9

Updated by Christof Rodejohann over 12 years ago

While fixing this issue please take into account problems arising from http://forge.typo3.org/issues/30486

Especially uid, pid and t3ver_state should never be used without especially defining the table. This is because when using a join you will always have uid, pid and t3ver in both tables. Therefore resulting in a "Error: ambigious parameter uid".

Furthermore we should take some time to think about how workspace's should be handled for the second part of the join.

Actions #10

Updated by Steffen Gebert over 12 years ago

  • Status changed from Accepted to Under Review
Actions #11

Updated by Björn Pedersen over 12 years ago

@Christof Rodejohann:

That#s what this patch is about.

Actions #12

Updated by Mr. Hudson over 12 years ago

Patch set 6 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #13

Updated by Mr. Hudson over 12 years ago

Patch set 7 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #14

Updated by Christof Rodejohann over 12 years ago

@Björn Pedersen

Kind of. The latest patch still fails on a basic join. I am quoting my test setup from http://forge.typo3.org/issues/30486

page = PAGE
page.10 = COA
page.10 {

  10 = CONTENT
  10 {
    table = tt_content
    select {            
      selectFields = tt_content.header,be_users.username
      join = be_users ON tt_content.cruser_id = be_users.uid
    }
    renderObj = COA
    renderObj {
      10 = TEXT
      10.field = header

      20 = TEXT
      20.field = username
    }  
  }
}

This setup fails with the latest patch and error "Column 'uid' in field list is ambiguous".

That is because you add the raw uid,pid and t3ver_state without the explicit database table name. You focus on the selectFields and table part. But the join setup adds another table and contains a different set of uid,pid and t3ver_state.

Adding the table name to uid,pid and t3ver_state from $table and aliasing them back to uid,pid and t3ver_state would be an easy fix. But how should workspace's be handled for the second part of the join?

Actions #15

Updated by Björn Pedersen over 12 years ago

@Christof:

The workspace part for the join probably is one of the border cases that I can not fix at the moment. In such a case it is still the responibility of the TS writer to ensure all the right fields are selected.

Actions #16

Updated by Christof Rodejohann over 12 years ago

@Björn:

IMHO this is fine. I am trying to push a patch for the $table part, so you won't have to do all the work. But i am having a lot of trouble with gerrit.

Actions #17

Updated by Mr. Hudson over 12 years ago

Patch set 8 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #18

Updated by Christof Rodejohann over 12 years ago

@Björn:

Patch set 8 resolves the join issue from http://forge.typo3.org/issues/30486. I believe this bug is resolved. Good work.

Actions #19

Updated by Mr. Hudson over 12 years ago

Patch set 9 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #20

Updated by Mr. Hudson over 12 years ago

Patch set 10 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #21

Updated by Mr. Hudson over 12 years ago

Patch set 11 of change I50332c22e627ea452aaee233fdbbdf3dd426a1b6 has been pushed to the review server.
It is available at http://review.typo3.org/4974

Actions #22

Updated by Björn Pedersen over 12 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #23

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF