mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
Fix array relationship aliasing (good news)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9438 Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com> GitOrigin-RevId: 14b225ad8c834f2aa9863cee951d39f203046282
This commit is contained in:
parent
0c38a693ac
commit
2c5e89e5d8
@ -229,7 +229,7 @@ processAnnAggregateSelect sourcePrefixes fieldAlias annAggSel = do
|
||||
aggregateFieldToExp thisSourcePrefix aggFields strfyNum
|
||||
)
|
||||
TAFNodes _ annFields -> do
|
||||
annFieldExtr <- processAnnFields thisSourcePrefix fieldName similarArrayFields annFields tCase
|
||||
annFieldExtr <- processAnnFields thisSourcePrefix fieldName annFields tCase
|
||||
pure
|
||||
( [annFieldExtr],
|
||||
withJsonAggExtr permLimitSubQuery (orderByForJsonAgg selectSource)
|
||||
@ -301,11 +301,10 @@ processAnnFields ::
|
||||
) =>
|
||||
TableIdentifier ->
|
||||
FieldName ->
|
||||
SimilarArrayFields ->
|
||||
AnnFields ('Postgres pgKind) ->
|
||||
Maybe NamingCase ->
|
||||
m (S.ColumnAlias, S.SQLExp)
|
||||
processAnnFields sourcePrefix fieldAlias similarArrFields annFields tCase = do
|
||||
processAnnFields sourcePrefix fieldAlias annFields tCase = do
|
||||
fieldExps <- forM annFields $ \(fieldName, field) ->
|
||||
(fieldName,)
|
||||
<$> case field of
|
||||
@ -345,15 +344,15 @@ processAnnFields sourcePrefix fieldAlias similarArrFields annFields tCase = do
|
||||
let sourcePrefixes = mkSourcePrefixes objRelSourcePrefix
|
||||
selectSource = ObjectSelectSource (_pfThis sourcePrefixes) ident filterExp
|
||||
objRelSource = ObjectRelationSource relName relMapping selectSource nullable
|
||||
annFieldsExtr <- processAnnFields (identifierToTableIdentifier $ _pfThis sourcePrefixes) fieldName HashMap.empty objAnnFields tCase
|
||||
annFieldsExtr <- processAnnFields (identifierToTableIdentifier $ _pfThis sourcePrefixes) fieldName objAnnFields tCase
|
||||
pure
|
||||
( objRelSource,
|
||||
uncurry InsOrdHashMap.singleton annFieldsExtr,
|
||||
S.mkQIdenExp objRelSourcePrefix fieldName
|
||||
)
|
||||
AFArrayRelation arrSel -> do
|
||||
let arrRelSourcePrefix = mkArrayRelationSourcePrefix sourcePrefix fieldAlias similarArrFields fieldName
|
||||
arrRelAlias = mkArrayRelationAlias fieldAlias similarArrFields fieldName
|
||||
let arrRelSourcePrefix = mkArrayRelationSourcePrefix sourcePrefix fieldAlias HashMap.empty fieldName
|
||||
arrRelAlias = mkArrayRelationAlias fieldAlias HashMap.empty fieldName
|
||||
processArrayRelation (mkSourcePrefixes arrRelSourcePrefix) fieldName arrRelAlias arrSel tCase
|
||||
pure $ S.mkQIdenExp arrRelSourcePrefix fieldName
|
||||
AFComputedField _ _ (CFSScalar scalar caseBoolExpMaybe) -> do
|
||||
@ -619,7 +618,6 @@ processAnnSimpleSelect sourcePrefixes fieldAlias permLimitSubQuery annSimpleSel
|
||||
processAnnFields
|
||||
(identifierToTableIdentifier $ _pfThis sourcePrefixes)
|
||||
fieldAlias
|
||||
similarArrayFields
|
||||
annSelFields
|
||||
tCase
|
||||
let allExtractors = InsOrdHashMap.fromList $ annFieldsExtr : orderByAndDistinctExtrs
|
||||
@ -785,7 +783,7 @@ processConnectionSelect sourcePrefixes fieldAlias relAlias colMapping connection
|
||||
<> "."
|
||||
<> edgeText
|
||||
edgeFieldIdentifier = toIdentifier edgeFieldName
|
||||
annFieldsExtrExp <- lift $ processAnnFields thisPrefix edgeFieldName similarArrayFields annFields tCase
|
||||
annFieldsExtrExp <- lift $ processAnnFields thisPrefix edgeFieldName annFields tCase
|
||||
modify' (<> [annFieldsExtrExp])
|
||||
pure $ S.SEIdentifier edgeFieldIdentifier
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user