On Sunday, July 23, 2017, Igor Korot <ikoro...@gmail.com> wrote: > Hi, David, > > On Sun, Jul 23, 2017 at 5:07 PM, David G. Johnston > <david.g.johns...@gmail.com <javascript:;>> wrote: > > On Sunday, July 23, 2017, Igor Korot <ikoro...@gmail.com <javascript:;>> > wrote: > >> > >> Is "IF" operator not supported by PostgreSQL > > So how do I write this properly? > > CREATE FUNCTION or a DO block. See docs for usage.
Since the language is pl/pgsql you can learn how to write it here. https://www.postgresql.org/docs/9.6/static/plpgsql.html David J.