Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmdsB-00041e-UK for pgsql-docs@arkaria.postgresql.org; Mon, 15 Nov 2021 15:26:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mmdsA-0001g5-Vl for pgsql-docs@arkaria.postgresql.org; Mon, 15 Nov 2021 15:26:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmdrY-0006fA-7R for pgsql-docs@lists.postgresql.org; Mon, 15 Nov 2021 15:25:40 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mmdrU-0003NM-Kn for pgsql-docs@lists.postgresql.org; Mon, 15 Nov 2021 15:25:39 +0000 Received: by mail-wm1-x32c.google.com with SMTP id n33-20020a05600c502100b0032fb900951eso10874177wmr.4 for ; Mon, 15 Nov 2021 07:25:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=eiHOUBg+TatPE6gh8S8sJblfqoiEA9dItkYTIjExXTA=; b=nHPrLK3nv9mn+OjGgJ7o51jxL3dGXw2SnoYrP5Cs80JcQ1S2BagkUYjdeLYJjIQ1tP Wfiz6zxPhp3EHBg9WPAjPTk4pkV/DVgmOKJ0Ub5Byc7rN7jQFfd9yrpjbk0tgwAkbLQV Z0J1IImJfFVlDiKEK2OSzxCcz2ONb1uVzlRXg8oIy1+yDTNiJ4nrG4LBcpWcluWlDKaQ DK2waNreHOkjnpyTJvKLNQQA+I2MCZX3Kh2RNpDiG1U7Cmi1j0rJxMiy+PoWDCchKxza 8ie7ireU8/OR8Wfn0yfCkWB4e9mcy/1Hy5CLFUK6yaO83Y7BWMsRqBIu98ga8PrhVynu 9wvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=eiHOUBg+TatPE6gh8S8sJblfqoiEA9dItkYTIjExXTA=; b=iBQuakJfMgjakauT0YFjtU9/M8lRhV1B271y2mPkOqEll6fZpsBYRlwb74C90yScSc n5jAbzFhzLDRa+YmLSQhh6eaiWgCdYOdVKUpfIMrA7fTg9Mqkz/hxBPkciva7rdzV4CS Q3dDOkQLTKl3u6LMzUOwAsOX+d1IZ3ynBIl7CP4Mcxy9nFsblJ7nqgmE8JHBncgAzJ62 KE+BfzJsb4dL8d9mLp9tGb8YohESRkvXdnaKX/+7KhsXT8X8O+vwWX0np/hSzf4zFwmR 8FWyMrjHSkywWWrmcfu6MJm2n3yxo6On3ImeCcXzbXhGFl3+Ixn3YC9TuzmJCWD4jAWR htfg== X-Gm-Message-State: AOAM533RX9wvIg5SOxEeB1CqT5OMHjHmaSD5J/P5gb3+ELM/KkHRAZ0J cL3M47F4uzHLOcj5XTDPB6/PrHQUdbztVA== X-Google-Smtp-Source: ABdhPJwULRoAr96RMggWuspfSCPqWjIQHtI67fkyw4ZxD/LH8kcQRdXLMY7ex4+0G0mZVyoTf4M3WA== X-Received: by 2002:a05:600c:40b:: with SMTP id q11mr42756592wmb.185.1636989934414; Mon, 15 Nov 2021 07:25:34 -0800 (PST) Received: from localhost.localdomain (62-47-145-242.adsl.highway.telekom.at. [62.47.145.242]) by smtp.gmail.com with ESMTPSA id p14sm11147969wms.29.2021.11.15.07.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 07:25:34 -0800 (PST) Message-ID: <053cb818710e43efa2e2098793014e5271dfdb55.camel@cybertec.at> Subject: Re: Error in sample on doc page From: Laurenz Albe To: postgresql@nowisit.net, pgsql-docs@lists.postgresql.org Date: Mon, 15 Nov 2021 16:25:33 +0100 In-Reply-To: <163695554137.11069.14314706306790865461@wrigleys.postgresql.org> References: <163695554137.11069.14314706306790865461@wrigleys.postgresql.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-2.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2021-11-15 at 05:52 +0000, PG Doc comments form wrote: > Two issues here: > 1) The CREATE EVENT TRIGGER command in the sample code does not execute (see > output below) It works just fine for me. > 2) When executed in an anonymous do block, there is no error. The CREATE > EVENT TRIGGER executed outside the do block should have given an error > saying already exists. Instead it gives the error: "ERROR: syntax error at > end of input". > > ae_lake.cdc> do $docbug$ >              BEGIN >                RAISE INFO 'Executing sample from PG docs: > https://www.postgresql.org/docs/13/functions-event-triggers.html...'; >                >                CREATE FUNCTION test_event_trigger_table_rewrite_oid() >                 RETURNS event_trigger >                 LANGUAGE plpgsql AS >                $$ >                BEGIN >                  RAISE NOTICE 'rewriting table % for reason %', >                               > pg_event_trigger_table_rewrite_oid()::regclass, >                                pg_event_trigger_table_rewrite_reason(); >                END; >                $$; >                >                CREATE EVENT TRIGGER test_table_rewrite_oid >                                ON table_rewrite >                 EXECUTE FUNCTION test_event_trigger_table_rewrite_oid(); >              >              END; >              $docbug$ > [2021-11-14 22:47:49] [00000] Executing sample from PG docs: > https://www.postgresql.org/docs/13/functions-event-triggers.html... > [2021-11-14 22:47:49] completed in 109 ms > ae_lake.cdc> CREATE EVENT TRIGGER test_table_rewrite_oid >                                ON table_rewrite > [2021-11-14 22:48:09] [42601] ERROR: syntax error at end of input > [2021-11-14 22:48:09] Position: 79 I don't get that error. Perhaps you inadvertently were on a continuation line in psql. Yours, Laurenz Albe