Fix embedded column conflicts table name (#996)

This commit is contained in:
grotsev
2017-10-05 21:03:27 -05:00
committed by Joe Nelson
parent 7bf384d0f8
commit 8f49f731d0
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- #962, OpenAPI don't err on nonexistent schema - @steve-chavez
- #954, make OpenAPI rpc output dependent on user privileges - @steve-chavez
- #955, Support configurable aud claim - @statik
- #996, Fix embedded column conflicts table name - @grotsev
## [0.4.3.0] - 2017-09-06
+2 -2
View File
@@ -245,7 +245,7 @@ requestToQuery schema isParent (DbRead (Node (Select colSelects tbls logicForest
getQueryParts (Node n@(_, (name, Just Relation{relType=Child,relTable=Table{tableName=table}}, alias, _)) forst) (j,s) = (j,sel:s)
where
sel = "COALESCE(("
<> "SELECT array_to_json(array_agg(row_to_json("<>pgFmtIdent table<>"))) "
<> "SELECT array_to_json(array_agg(row_to_json("<>pgFmtIdent table<>".*))) "
<> "FROM (" <> subquery <> ") " <> pgFmtIdent table
<> "), '[]') AS " <> pgFmtIdent (fromMaybe name alias)
where subquery = requestToQuery schema False (DbRead (Node n forst))
@@ -262,7 +262,7 @@ requestToQuery schema isParent (DbRead (Node (Select colSelects tbls logicForest
getQueryParts (Node n@(_, (name, Just Relation{relType=Many,relTable=Table{tableName=table}}, alias, _)) forst) (j,s) = (j,sel:s)
where
sel = "COALESCE (("
<> "SELECT array_to_json(array_agg(row_to_json("<>pgFmtIdent table<>"))) "
<> "SELECT array_to_json(array_agg(row_to_json("<>pgFmtIdent table<>".*))) "
<> "FROM (" <> subquery <> ") " <> pgFmtIdent table
<> "), '[]') AS " <> pgFmtIdent (fromMaybe name alias)
where subquery = requestToQuery schema False (DbRead (Node n forst))