Skip to content

Commit

Permalink
server: fix issue when remote relationship col has a custom GQL name
Browse files Browse the repository at this point in the history
GitOrigin-RevId: ca45383
  • Loading branch information
codingkarthik authored and hasura-bot committed Mar 9, 2021
1 parent 3ad42ed commit 0a7d634
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

- server/mssql: support tracking and querying from views
- server: inherited roles for PG queries and subscription
- server: fix issue when a remote relationship's joining field had a custom GraphQL name defined (fix #6626)
- cli: add support for rest endpoints
- cli: support mssql sources
- cli: use relative paths in metadata !include directives
Expand Down
2 changes: 1 addition & 1 deletion server/src-lib/Hasura/GraphQL/Schema/Select.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ remoteRelationshipFieldPG remoteFieldInfo = runMaybeT do
hoistMaybe $ Map.lookup remoteSchemaName remoteRelationshipQueryCtx
let fieldDefns = map P.fDefinition (piQuery parsedIntrospection)
role <- askRoleName
let hasuraFieldNames = Set.map (FieldName . G.unName . pgiName) hasuraFields
let hasuraFieldNames = Set.map (FieldName . PG.getPGColTxt . pgiColumn) hasuraFields
remoteRelationship = RemoteRelationship name source table hasuraFieldNames remoteSchemaName remoteFields
(newInpValDefns, remoteFieldParamMap) <-
if | role == adminRoleName ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
data:
profiles:
- id: 1
profile_name: alice
messageBasic:
name: alice
query:
query: |
query {
profiles {
id
profile_name
messageBasic {
name
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# A top-level object
p_1: profiles_by_pk(id: 1) {
id
name
name: profile_name
remoteUser {
user_id
}
Expand All @@ -71,7 +71,7 @@
name
msg
}
name
name: profile_name
# use alias for kicks:
r_user: remoteUser {
user_id
Expand All @@ -80,7 +80,7 @@
# A top-level object
profiles_by_pk(id: 2) {
id
name
name: profile_name
remoteUser {
user_id
}
Expand Down Expand Up @@ -117,7 +117,7 @@
# A top-level object
p_1: profiles_by_pk(id: 1) {
id
name
name: profile_name
remoteUser {
user_id
}
Expand All @@ -129,7 +129,7 @@
name
msg
}
name
name: profile_name
# use alias for kicks:
r_user: remoteUser {
user_id
Expand All @@ -138,7 +138,7 @@
# A top-level object (not permitted)
profiles_by_pk(id: 2) {
id
name
name: profile_name
remoteUser {
user_id
}
Expand Down Expand Up @@ -172,7 +172,7 @@
# A top-level object
p_1: profiles_by_pk(id: 1) {
id
name
name: profile_name
remoteUser {
user_id
}
Expand All @@ -184,7 +184,7 @@
name
msg
}
name
name: profile_name
# use alias for kicks:
r_user: remoteUser {
user_id
Expand All @@ -193,7 +193,7 @@
# A top-level object
profiles_by_pk(id: 2) {
id
name
name: profile_name
remoteUser {
user_id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ args:
schema: public
name: profiles

- type: set_table_customization
args:
table: profiles
configuration:
custom_column_names:
name: profile_name

- type: create_select_permission
args:
table:
Expand Down

0 comments on commit 0a7d634

Please sign in to comment.