NAMES SET NAMES value is an alias for SET client_encoding TO value. it should be: SET NAMES 'value' is an alias for SET client_encoding TO value. https://www.postgresql.org/docs/current/sql-set.html
pgsql-docs by date:
Соглашаюсь с условиями обработки персональных данных