public inbox for [email protected]
help / color / mirror / Atom feedRe: Error on the query
3+ messages / 2 participants
[nested] [flat]
* Re: Error on the query
@ 2025-03-04 17:35 Pavel Stehule <[email protected]>
parent: Igor Korot <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Stehule @ 2025-03-04 17:35 UTC (permalink / raw)
To: Igor Korot <[email protected]>; +Cc: pgsql-generallists.postgresql.org <[email protected]>
Hi
út 4. 3. 2025 v 18:30 odesílatel Igor Korot <[email protected]> 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.
>
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Error on the query
@ 2025-03-04 22:51 Igor Korot <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: Igor Korot @ 2025-03-04 22:51 UTC (permalink / raw)
To: pgsql-generallists.postgresql.org <[email protected]>
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?
Thank you.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Error on the query
@ 2025-03-04 23:04 Igor Korot <[email protected]>
parent: Pavel Stehule <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: Igor Korot @ 2025-03-04 23:04 UTC (permalink / raw)
To: Pavel Stehule <[email protected]>; +Cc: pgsql-generallists.postgresql.org <[email protected]>
Hi, Pavel,
On Tue, Mar 4, 2025 at 11:36 AM Pavel Stehule <[email protected]> wrote:
>
> Hi
>
> út 4. 3. 2025 v 18:30 odesílatel Igor Korot <[email protected]> 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;
> $$;
Thank you.
Works now.
>
> Regards
>
> Pavel
>>
>>
>> Thank you.
>>
>>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-03-04 23:04 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-04 22:51 Error on the query Igor Korot <[email protected]>
2025-03-04 17:35 ` Pavel Stehule <[email protected]>
2025-03-04 23:04 ` Igor Korot <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox