Subject: Re: Error on the query

From: Pavel Stehule <[email-masked]>
Date: Tue, 4 Mar 2025 18:35:23 +0100

Hi

út 4. 3. 2025 v 18:30 odesílatel Igor Korot <[email-masked]> napsal:

> Hi, ALL,
> Trying to execute following query:
>
> [code]
>         queries.push_back( L"DO $$ BEGIN IF NOT EXISTS( SELECT 1 FROM
> pg_class c, pg_namespace n WHERE n.oid = c.relnamespace AND c.relname
> = \'abcatc_x\' AND n.nspname = \'public\' ) THEN CREATE UNIQUE INDEX
> \"abcatc_x\" ON \"abcatcol\"(\"abc_tnam\" ASC, \"abc_ownr\" ASC,
> \"abc_cnam\" ASC); END IF; END;" );
> [/code]
>
> I got:
>
> [quote]
> $4 = L"ERROR:  unterminated dollar-quoted string at or near \"$$ BEGIN
> IF NOT EXISTS( SELECT 1 FROM pg_class c, pg_namespace n WHERE n.oid =
> c.relnamespace AND c.relna
> me = 'abcatc_x' AND n.nspname = 'public' "...
>
> [/quote]
>
> What am I missing?
>

you miss ending string separator

DO $$ .... $$;

DO $$
BEGIN
  IF ... THEN
  END IF;
END;
$$;

Regards

Pavel

> Thank you.

---

From: Igor Korot <[email-masked]>
Date: Tue, 4 Mar 2025 16:51:14 -0600

Hi, ALL,

[code]

I got:

[quote]

[/quote]

What am I missing?

Thank you.

---

From: Igor Korot <[email-masked]>
Date: Tue, 4 Mar 2025 17:04:43 -0600

Hi, Pavel,

> you miss ending string separator

Thank you.
Works now.