Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tpWJM-0073nh-14 for pgsql-general@arkaria.postgresql.org; Tue, 04 Mar 2025 17:44:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tpWJK-003j7C-K9 for pgsql-general@arkaria.postgresql.org; Tue, 04 Mar 2025 17:44:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tpWJK-003j73-8y for pgsql-general@lists.postgresql.org; Tue, 04 Mar 2025 17:44:06 +0000 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tpWJG-000wKw-10 for pgsql-general@lists.postgresql.org; Tue, 04 Mar 2025 17:44:05 +0000 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-6f47ed1f40dso45507077b3.1 for ; Tue, 04 Mar 2025 09:44:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741110242; x=1741715042; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hLGeD9iHGW0IiN/8V3qU/lnl4u71jqlZycANDtRuQ9I=; b=GtMDro7QL+bgNVf5VT46wnPdhl+cwsk0oK0pf6BdjLB8IKtWpWL9iMNb46QBY+Zkgv Albg7LqH5Kw92+Lv9ERU50SIftf9HHJl3OTxQNdEfWpl2wEIbuLfQd6aRnCS2jB3oCTo t/cTZfm/fDmgmCV4gsyupwZ7rI0tMztDI0epIqAxLOSvKeoQ1HfdEwII9zymWhUaN3+y YAeT7ci+o8gGwpGG/O++mTk1rhnR/D4fKcEIwmx5BCVz+kuIS1oF2o8qz33YzqYEO/b4 Hp3A2MLFaHyPeu6pb2lGnkbqYkczPUKSrexkECBKJaPBGlIi6mqv484sd9SqfMP59WY7 52QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741110242; x=1741715042; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hLGeD9iHGW0IiN/8V3qU/lnl4u71jqlZycANDtRuQ9I=; b=VXQoaIuoBSDYLNK+ikF+oZ4qzTEwCxanOorF0lmsKA3kFUc1DR3kGPCUH1RVYpAQKx VUfg9MkZwaqJVKDxV9o0zGApqDdLpfFzEF/VEBxpfbq6+/R4kSv6JhD3rvQsEOMUm3Wo fmHTo7nGEypjhf1JdgNshgH6j9KmGIcG1XGJhv+UULOHHRzkF8QU6T/Q3amqVAMO7Hbz 8Om9zQKtYPit/VU2/WiMyEKh2mt0a7r/oZa6iZ+ziG2QbAnIOx01ej13Zjexsg9ZCnWZ +FxPIcAwhfX1ewviXrxaYM/0p+i0WZtfVLKqkdywUay5ECXh0PC4RJqWiZJx/rq9aKF+ NI0g== X-Gm-Message-State: AOJu0Yy2Xxn5goXYXFNBeUI9IOx3DqiW95LTR+TlgzTeRhmzBdrkiYAV vw2llq9/ir6kdEZJ96sBG9c/z9xVMQuQDP1P/ZtgePbe/pcNGcAEIk39Strj1QA6s6hRVbJqb2g mWhsOOm8jnXiAOVUmQUNMz74Rkbs= X-Gm-Gg: ASbGnctO7qaZKFM517rIvyn+WdC0bXmTzPoTQ1KCxeLPwHFLqIRX8LkjFEBdvrLrRLw I6tk8f3tdif0mRujW6sL6TdMq1sdgqSv21hMdbunwgn3tQoCWBa8uj9TnT4TjQlYs8qpnpq6P+j FLYBbF0rvcHX+W0wZfiTkXToBcYgqDJWtn/U+JnQ== X-Google-Smtp-Source: AGHT+IEUVCGYXmYGt9A4fy8u5DFm9cfTrfbgewOrQlfWAx6k5dPMbQ9v2tvevP9eS2RqegVL8a0mb4DWWHrk6IJy5KU= X-Received: by 2002:a05:690c:6d12:b0:6ef:60f4:3d41 with SMTP id 00721157ae682-6fda2f5d6ddmr3136027b3.16.1741110242255; Tue, 04 Mar 2025 09:44:02 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Igor Korot Date: Tue, 4 Mar 2025 17:04:43 -0600 X-Gm-Features: AQ5f1JqVIR7vOuCSFD9R_EQD9CTeLSUqu7TBxTl1FE-_xDT_rMSTvytPi3B2aRA Message-ID: Subject: Re: Error on the query To: Pavel Stehule Cc: "pgsql-generallists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Pavel, On Tue, Mar 4, 2025 at 11:36=E2=80=AFAM Pavel Stehule wrote: > > Hi > > =C3=BAt 4. 3. 2025 v 18:30 odes=C3=ADlatel Igor Korot 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 =3D c.relnamespace AND c.relname >> =3D \'abcatc_x\' AND n.nspname =3D \'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 =3D 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 =3D >> c.relnamespace AND c.relna >> me =3D 'abcatc_x' AND n.nspname =3D '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. >> >>