pg_gather icon indicating copy to clipboard operation
pg_gather copied to clipboard

ERRORs while running. ERROR: syntax error at or near ":" invalid command \if invalid command \endif

Open jobinau opened this issue 3 years ago • 2 comments

A sample pg_gather (gather.sql) output is

psql:/app/gather.sql:5: ERROR:  syntax error at or near ":"
LINE 1: SELECT ( :SERVER_VERSION_NUM > 120000 ) AS pg12, ( :SERVER_V...
                 ^
psql:/app/gather.sql:7: invalid command \if
SELECT (SELECT count(*) > 1 FROM pg_srvr) AS conlines \gset
\if :conlines
\echo SOMETHING WRONG, EXITING
SOMETHING WRONG, EXITING;
\q
\endif
psql:/app/gather.sql:15: invalid command \endif
Tuples only is on.
\t
\r
psql:/app/gather.sql:27: invalid command \if
COPY pg_srvr FROM stdin;

jobinau avatar Jul 20 '21 05:07 jobinau

These problems are mainly reported when data is collected from jump/bastion hosts. These errors indicate that the psql version is very old. you may check

psql --version

pg_gather expects a recent version of psql Avoid installing PostgreSQL binaries from Linux repo, Highly encouraged to install PostgreSQL clients and libraries from PGDG repositories and always make sure that psql version before running the gather.sql. A psql version which is the same as the PostgreSQL major version is highly reccommended.

jobinau avatar Jul 20 '21 06:07 jobinau

This is no a bug. So this will be never fixed

jobinau avatar Jul 20 '21 06:07 jobinau