Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

### Fixed

- Fix schema conflict result_type for native query mutations.
([#405](https://github.com/hasura/ndc-postgres/pull/405))

## [v0.5.2] - 2024-03-29

### Added
Expand Down
43 changes: 23 additions & 20 deletions crates/connectors/ndc-postgres/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,25 +268,29 @@ pub async fn get_schema(
.0
.iter()
.filter(|(_, nq_info)| nq_info.is_procedure)
.map(|(nq_name, nq_info)| models::ProcedureInfo {
name: nq_name.clone(),
description: nq_info.description.clone(),
arguments: nq_info
.arguments
.iter()
.map(|(column_name, column_info)| {
(
column_name.clone(),
models::ArgumentInfo {
description: column_info.description.clone(),
argument_type: readonly_column_to_type(column_info),
},
)
})
.collect(),
result_type: models::Type::Named {
name: nq_name.clone(),
},
.map(|(nq_name, nq_info)| {
make_procedure_type(
nq_name.clone(),
nq_info.description.clone(),
nq_info
.arguments
.iter()
.map(|(column_name, column_info)| {
(
column_name.clone(),
models::ArgumentInfo {
description: column_info.description.clone(),
argument_type: readonly_column_to_type(column_info),
},
)
})
.collect(),
models::Type::Named {
name: nq_name.clone(),
},
&mut object_types,
&mut scalar_types,
)
})
.collect();

Expand Down Expand Up @@ -566,7 +570,6 @@ fn make_procedure_type(
description: Option<String>,
arguments: BTreeMap<String, models::ArgumentInfo>,
result_type: models::Type,

object_types: &mut BTreeMap<String, models::ObjectType>,
scalar_types: &mut BTreeMap<String, models::ScalarType>,
) -> models::ProcedureInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2899,6 +2899,28 @@ expression: result
}
}
},
"delete_playlist_track_response": {
"description": "Responses from the 'delete_playlist_track' procedure",
"fields": {
"affected_rows": {
"description": "The number of rows affected by the mutation",
"type": {
"type": "named",
"name": "int4"
}
},
"returning": {
"description": "Data from rows affected by the mutation",
"type": {
"type": "array",
"element_type": {
"type": "named",
"name": "delete_playlist_track"
}
}
}
}
},
"discoverable_types": {
"fields": {
"only_occurring_here1": {
Expand Down Expand Up @@ -2963,6 +2985,28 @@ expression: result
}
}
},
"insert_album_response": {
"description": "Responses from the 'insert_album' procedure",
"fields": {
"affected_rows": {
"description": "The number of rows affected by the mutation",
"type": {
"type": "named",
"name": "int4"
}
},
"returning": {
"description": "Data from rows affected by the mutation",
"type": {
"type": "array",
"element_type": {
"type": "named",
"name": "insert_album"
}
}
}
}
},
"insert_artist": {
"fields": {
"ArtistId": {
Expand All @@ -2985,6 +3029,28 @@ expression: result
}
}
},
"insert_artist_response": {
"description": "Responses from the 'insert_artist' procedure",
"fields": {
"affected_rows": {
"description": "The number of rows affected by the mutation",
"type": {
"type": "named",
"name": "int4"
}
},
"returning": {
"description": "Data from rows affected by the mutation",
"type": {
"type": "array",
"element_type": {
"type": "named",
"name": "insert_artist"
}
}
}
}
},
"make_person": {
"description": "A native query used to test support for composite types",
"fields": {
Expand Down Expand Up @@ -4976,7 +5042,7 @@ expression: result
},
"result_type": {
"type": "named",
"name": "delete_playlist_track"
"name": "delete_playlist_track_response"
}
},
{
Expand Down Expand Up @@ -5012,7 +5078,7 @@ expression: result
},
"result_type": {
"type": "named",
"name": "insert_album"
"name": "insert_album_response"
}
},
{
Expand All @@ -5039,7 +5105,7 @@ expression: result
},
"result_type": {
"type": "named",
"name": "insert_artist"
"name": "insert_artist_response"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2398,6 +2398,28 @@ expression: result
}
}
},
"delete_playlist_track_response": {
"description": "Responses from the 'delete_playlist_track' procedure",
"fields": {
"affected_rows": {
"description": "The number of rows affected by the mutation",
"type": {
"type": "named",
"name": "int4"
}
},
"returning": {
"description": "Data from rows affected by the mutation",
"type": {
"type": "array",
"element_type": {
"type": "named",
"name": "delete_playlist_track"
}
}
}
}
},
"discoverable_types_root_occurrence": {
"fields": {
"col": {
Expand Down Expand Up @@ -2448,6 +2470,28 @@ expression: result
}
}
},
"insert_album_response": {
"description": "Responses from the 'insert_album' procedure",
"fields": {
"affected_rows": {
"description": "The number of rows affected by the mutation",
"type": {
"type": "named",
"name": "int4"
}
},
"returning": {
"description": "Data from rows affected by the mutation",
"type": {
"type": "array",
"element_type": {
"type": "named",
"name": "insert_album"
}
}
}
}
},
"insert_artist": {
"fields": {
"ArtistId": {
Expand All @@ -2470,6 +2514,28 @@ expression: result
}
}
},
"insert_artist_response": {
"description": "Responses from the 'insert_artist' procedure",
"fields": {
"affected_rows": {
"description": "The number of rows affected by the mutation",
"type": {
"type": "named",
"name": "int4"
}
},
"returning": {
"description": "Data from rows affected by the mutation",
"type": {
"type": "array",
"element_type": {
"type": "named",
"name": "insert_artist"
}
}
}
}
},
"pg_extension_spatial_ref_sys": {
"description": "Shows all defined Spatial Reference Identifiers (SRIDs). Matches PostGIS' spatial_ref_sys table.",
"fields": {
Expand Down Expand Up @@ -4421,7 +4487,7 @@ expression: result
},
"result_type": {
"type": "named",
"name": "delete_playlist_track"
"name": "delete_playlist_track_response"
}
},
{
Expand Down Expand Up @@ -4457,7 +4523,7 @@ expression: result
},
"result_type": {
"type": "named",
"name": "insert_album"
"name": "insert_album_response"
}
},
{
Expand All @@ -4484,7 +4550,7 @@ expression: result
},
"result_type": {
"type": "named",
"name": "insert_artist"
"name": "insert_artist_response"
}
},
{
Expand Down
Loading