Igor Korot <ikoro...@gmail.com> writes: > On Sat, Mar 22, 2025, 8:58 PM David G. Johnston <david.g.johns...@gmail.com> > wrote: >> Then read the psql docs. Your version has \if and you’ll find server >> version listed as the available client variables.
> I was hoping for something like > If server_version >= X: > CREATE OR REPLACE TRIGGER... psql's \if doesn't (yet) have any native expression evaluation ability, so you have to farm out the ">=" comparison. The psql docs suggest relying on the server to do it, which would go along the lines of select current_setting('server_version_num')::int >= 130000 as v13 \gset \if :v13 ... do something \else ... do something else \endif You could also do the comparison client-side, along the lines of \set v13 `expr :SERVER_VERSION_NUM \>= 130000` \if :v13 ... etc But that introduces assorted platform dependencies and requires close attention to correct shell quoting, so it's seldom preferable IMO. regards, tom lane