Annotation query from postgresql not showing up in graph

Hello,

I’ve only recently started using grafana (4.6.1). Cool project. I use PostgreSQL as the only data source. Currently I am trying to load annotations via an PostgreSQL query. For this purpose, I have created and activated an annotation query that looks like this:

SELECT
$__time (startdatetime),
‘Stationbook’ as title,
notation as text,
tags
FROM “data”. grafana_stationbook
WHERE $__timeFilter(startdatetime)
order by startdatetime;

The query would return the following values:

| time | title | text | tags
| 2017-11-23 17:25:00 | Stationbook | Problem mit No2 | PID170,Reparatur,Sonstiges
| 2017-11-23 19:41:00 | Stationbook | Test annotation2 | PID167,Alarm H2,Alarm O2

Now my questions:
What must be done to display the anotations in the graphics? At the moment, nothing is showing up.
Can annotations be linked to specific data series using the tags or are all annotations always displayed in the graphics? E.g. I would like to link the tag ‘PID171’ to graphicseries with ID 171.

Many thanks in advance,
Christian

For annotation queries you need to return unix timestamps in the time column.
The following should work:

SELECT
extract(epoch from startdatetime) as time,
'Stationbook ' || notation as text,
tags
FROM “data”. grafana_stationbook
WHERE $__timeFilter(startdatetime)
order by startdatetime