Cannot get data source name in query

I recently upgraded Grafana to the latest version and I noticed the ${datasource} variable has changed to return the id of the data source instead of the name. I am using this Postgresql query:

SELECT * FROM log_records
WHERE tag  = 'error.${datasource}'

The WHERE clause used to become error.+ the name of the data source, but since the latest version it has become the internal Grafana id. How can I get the actual name of the currently selected data source? I tried doing ${datasource.name} but it doesn’t work.

Use the syntax: ${datasource:text}