What is the problem with this query?

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: What is the problem with this query?
Date: 2017-07-23 20:58:03
Message-ID: CA+FnnTyGHBKZeTRNrR780TF51uPaRyT=apNgX=QaBwfbp7H94w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, ALL,

draft=# IF NOT EXISTS( SELECT 1 FROM pg_class c, pg_namespace n WHERE
n.oid = c.relnamespace AND c.relname = 'abcattbl_tnam_ownr' AND
n.nspname = 'public' ) THEN CREATE INDEX "abcattbl_tnam_ownr" ON
"abcattbl"("abt_tnam" ASC, "abt_ownr" ASC);
ERROR: syntax error at or near "IF"
LINE 1: IF NOT EXISTS( SELECT 1 FROM pg_class c, pg_namespace n WHER...
^

Is "IF" operator not supported by PostgreSQL?

Thank you.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2017-07-23 21:07:46 Re: What is the problem with this query?
Previous Message Michael Paquier 2017-07-23 17:38:44 Re: pg_dump not dropping event trigger