Moving mysql union query to postgresql
The issue is relevant to this whole part and not just  "user_firstname".

SELECT        
          "user_firstname"
        , "user_lastname"
        , "course_fullname"
        , "course_completion_completeddate"
        , "course_completion_status"
        , "ESR Employee Number"
        , "DH Job Role"
        , "Department"
        from mdl_course_completions


In MySQL "user_firstname" is interpreted as a string (which probably wasn't you intention)
In PostgreSQL "user_firstname" is interpreted as a column name.



Demo

create table t (x int);
insert into t (x) values (1),(2),(3);

select "x" as col from t;


PostgreSQL

+---+
|col|
+---+
| 1 |
+---+
| 2 |
+---+
| 3 |
+---+


MySQL

+---+
|col|
+---+
| x |
+---+
| x |
+---+
| x |
+---+