Describe the bug
Performing a $sqlquery-export against the server with an inline view definition that is also referenced inside the query field in that request is reported back as invalid with an "undeclared table".
To Reproduce
Request:
POST /$sqlquery-export
Accept:application/fhir+json
Content-Type:application/fhir+json
Prefer:respond-async
{
"resourceType": "Parameters",
"parameter": [
{
"name": "query",
"part": [
{
"name": "queryResource",
"resource": {
"resourceType": "Library",
"status": "active",
"type": {
"coding": [
{
"system": "https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes",
"code": "sql-query"
}
]
},
"content": [
{
"contentType": "application/sql",
"data": "U0VMRUNUIGNvdW50KCopIEFTIG4gRlJPTSB2ZXJpZnlfcGF0aWVudA==",
"extension": [
{
"url": "https://sql-on-fhir.org/ig/StructureDefinition/sql-text",
"valueString": "SELECT count(*) AS n FROM verify_patient"
}
]
}
]
}
}
]
},
{
"name": "view",
"part": [
{ "name": "name", "valueString": "verify_patient" },
{
"name": "viewResource",
"resource": {
"resourceType": "ViewDefinition",
"url": "https://example.org/ViewDefinition/verify_patient",
"name": "verify_patient",
"status": "active",
"resource": "Patient",
"select": [
{
"column": [
{ "path": "getResourceKey()", "name": "patient_id" }
]
}
]
}
}
]
},
{
"name": "_format",
"valueCode": "ndjson"
}
]
}
Returns:
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "SQL references an undeclared table: verify_patient"
}
]
}
Expected behavior
I expect it to resolve the inline resource and return a 202 with a polling location.
Describe the bug
Performing a
$sqlquery-exportagainst the server with an inline view definition that is also referenced inside the query field in that request is reported back as invalid with an "undeclared table".To Reproduce
Request:
POST /$sqlquery-export
{ "resourceType": "Parameters", "parameter": [ { "name": "query", "part": [ { "name": "queryResource", "resource": { "resourceType": "Library", "status": "active", "type": { "coding": [ { "system": "https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes", "code": "sql-query" } ] }, "content": [ { "contentType": "application/sql", "data": "U0VMRUNUIGNvdW50KCopIEFTIG4gRlJPTSB2ZXJpZnlfcGF0aWVudA==", "extension": [ { "url": "https://sql-on-fhir.org/ig/StructureDefinition/sql-text", "valueString": "SELECT count(*) AS n FROM verify_patient" } ] } ] } } ] }, { "name": "view", "part": [ { "name": "name", "valueString": "verify_patient" }, { "name": "viewResource", "resource": { "resourceType": "ViewDefinition", "url": "https://example.org/ViewDefinition/verify_patient", "name": "verify_patient", "status": "active", "resource": "Patient", "select": [ { "column": [ { "path": "getResourceKey()", "name": "patient_id" } ] } ] } } ] }, { "name": "_format", "valueCode": "ndjson" } ] }Returns:
{ "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "processing", "diagnostics": "SQL references an undeclared table: verify_patient" } ] }Expected behavior
I expect it to resolve the inline resource and return a 202 with a polling location.