Issue Bug Closed

#1087651 ambiguous column name: uid

Markus Klein 01/25/26, 12:16 updated 01/26/26, 00:00

Description

Editing ‘defaultAsReadonly “1” on page “l10nreadonly”’ from styleguide on current main causes 3 error messages

> An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 ambiguous column name: uid. A SQL error occurred. This may indicate a schema mismatch between TCA and the database. Try running database compare in the Install Tool.

Debugging shows that “select_single” field is on of the fields causing this.

This is tested on sqlite.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 7

  1. Markus Klein commented <span data-processor="relativetime" data-value="2026-01-25T12:18:27+00:00" > 01/25/26, 12:18 </span>

    Query causing this:

    SELECT "joined_table".* FROM (SELECT "tx_styleguide_staticdata"."uid", "tx_styleguide_staticdata"."pid", "tx_styleguide_staticdata"."value_1" FROM "tx_styleguide_staticdata", "pages" WHERE ("tx_styleguide_staticdata"."value_1" LIKE '%foo%') AND ( 1=1) AND ("pages"."uid" = "tx_styleguide_staticdata"."pid") AND ((("pages"."deleted" = 0) AND ((("pages"."t3ver_wsid" = 0) AND ((("pages"."t3ver_oid" = 0) OR ("pages"."t3ver_state" = 4))))))) ORDER BY "uid") "inner_table_alias" INNER JOIN "tx_styleguide_staticdata" "joined_table" ON "joined_table"."uid" = "inner_table_alias"."uid"
  2. Markus Klein commented <span data-processor="relativetime" data-value="2026-01-25T12:23:24+00:00" > 01/25/26, 12:23 </span>

    TCA has `foreign_table_where = AND {#tx_styleguide_staticdata}.{#value_1} LIKE ‘foo’ ORDER BY uid`

    In query the “order by uid” is the problem.

  3. Markus Klein commented <span data-processor="relativetime" data-value="2026-01-25T12:30:33+00:00" > 01/25/26, 12:30 </span>

    A possible solution probably is using `ORDER BY tx_styleguide_staticdata.uid` in TCA, but I’m not sure if the result is correct, because I presume the result should be sorted by `joined_table.uid`.

    Sidenote: foreign_table_where = AND {#tx_styleguide_staticdata}.{#value_1} LIKE '%foo%' ORDER BY {#tx_styleguide_staticdata}.uid does NOT work, the escaping is not processed for the orderby part.

  4. Benni Mack commented <span data-processor="relativetime" data-value="2026-01-25T12:59:13+00:00" > 01/25/26, 12:59 </span>

    Markus Klein wrote in #note-4:
    > A possible solution probably is using `ORDER BY tx_styleguide_staticdata.uid` in TCA, but I’m not sure if the result is correct, because I presume the result should be sorted by `joined_table.uid`.
    >
    > Sidenote: foreign_table_where = AND {#tx_styleguide_staticdata}.{#value_1} LIKE '%foo%' ORDER BY {#tx_styleguide_staticdata}.uid does NOT work, the escaping is not processed for the orderby part.

    This might be related to this issue then? #108534