The documentation (10 and 9.6) contains a typo when mentioning 'Special local variables PG_something'. Instead it should be 'Special local variables TG_something' as it is for trigger local variables.
Examples just below all start with TG_ so it should be obvious.