[
https://jira.nuxeo.org/browse/NXP-5495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=80078#action_80078
]
Florent Guillaume commented on NXP-5495:
----------------------------------------
A backport can simply do:
---
a/nuxeo-platform-tag-service/nuxeo-platform-tag-core/src/main/java/org/nuxeo/ecm/platform/tag/TagQueryMaker.java
+++
b/nuxeo-platform-tag-service/nuxeo-platform-tag-core/src/main/java/org/nuxeo/ecm/platform/tag/TagQueryMaker.java
@@ -49,6 +49,8 @@
protected String type;
protected int tagJoinIndex;
+
+ protected Column firstSelectedColumn;
@Override
public String getName() {
@@ -108,6 +110,9 @@
@Override
protected String getSelectColName(Column col) {
String name = super.getSelectColName(col);
+ if (firstSelectedColumn == null) {
+ firstSelectedColumn = col;
+ }
if (type == COUNT_SOURCE
&& col.getTable().getName().equalsIgnoreCase("relation")
&& col.getKey().equals("source")) {
@@ -131,8 +136,7 @@
protected void fixSelect(Select select) {
if (type == COUNT_SOURCE) {
// add a GROUP BY on first col
- String name = dialect.openQuote() + COL_ALIAS_PREFIX + "1"
- + dialect.closeQuote();
+ String name = firstSelectedColumn.getFullQuotedName();
select.setGroupBy(name);
}
}
> SQL Server and Oracle fail to navigate by tags
> ----------------------------------------------
>
> Key: NXP-5495
> URL: https://jira.nuxeo.org/browse/NXP-5495
> Project: Nuxeo Enterprise Platform
> Issue Type: Bug
> Components: Core SQL Storage, Tagging
> Affects Versions: 5.3.2
> Reporter: Florent Guillaume
> Assignee: Florent Guillaume
> Priority: Major
> Fix For: 5.4
>
>
> When navigating by tag using SQL Server or Oracle we get this error:
> SQL Server:
> TRACE [JDBCMapperLogger] (3) SQL: SELECT [tag].[label] AS [_C1],
> COUNT(DISTINCT [relation].[source]) AS [_C2] FROM [hierarchy] LEFT JOIN
> [relation] ON [hierarchy].[id] = [relation].[id] LEFT JOIN [tag] ON
> [relation].[target] = [tag].[id] WHERE [hierarchy].[primarytype] IN
> ('Tagging') GROUP BY [_C1]
> ERROR [viewhandler] ... Invalid query: NXTAG: COUNTSOURCE: SELECT
> tag:label, relation:source FROM Tagging
> Caused by: java.sql.SQLException. message: Invalid column name '_C1'.
> Oracle:
> TRACE [JDBCMapperLogger] (17) SQL: SELECT "TAG"."LABEL" AS "_C1",
> COUNT(DISTINCT "RELATION"."SOURCE") AS "_C2" FROM "HIERARCHY", "RELATION",
> "TAG" WHERE "HIERARCHY"."ID" = "RELATION"."ID"(+) AND "RELATION"."TARGET" =
> "TAG"."ID"(+) AND "HIERARCHY"."PRIMARYTYPE" IN ('Tagging') GROUP BY "_C1"
> Invalid query: NXTAG: COUNTSOURCE: SELECT tag:label, relation:source FROM
> Tagging
> Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception:
> java.sql.SQLException. message: ORA-00904: "_C1": invalid identifier
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets