Support for literals in SELECT clause


Most SQL-like languages have the ability of returning literals (constants) as results of the query. It could be useful for CDSS-like queries. e.g.

SELECT "true" as dangerousBP
FROM EHR [ehr_id/value=$ehrUid] CONTAINS COMPOSITION [openEHR-EHR-COMPOSITION.encounter.v1]

WHERE obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude>= 180 OR
obs/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude>= 40

Bostjan: already implemented in Think!EHR
SA: could be done by a function 'const'?


Ian McNicoll
January 14, 2021, 12:10 AM

with all the experience/competency of a clinical hacker I will offer my support for ‘literals’ (sometimes known as ‘constants’ in certain SQL implementations)’).


Matija Polajnar
January 14, 2021, 7:14 PM

I would actually prefer to only use the term “literal” and never mention “constants” in this context, but if the others wish to have that clarification in the text, I won’t oppose it.

Sebastian Iancu
January 18, 2021, 1:02 AM

ok, agree and changed text according to suggestions above

Thomas Beale
5 days ago

In 3.4.12, the following text “All strings are enclosed in double or single quotes. Line breaks are not supported.” should probably read “All string literals…”.

Sebastian Iancu
4 days ago

done this now in


Diego Bosca


Affects versions