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 1qZHg2-004qQc-5Z for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Aug 2023 21:15:38 +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 1qZHg0-00D9UB-82 for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Aug 2023 21:15:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qZGrD-00CiTg-Hh for pgsql-bugs@lists.postgresql.org; Thu, 24 Aug 2023 20:23:07 +0000 Received: from mail-yt3can01on20630.outbound.protection.outlook.com ([2a01:111:f403:7053::630] helo=CAN01-YT3-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qZGrA-000lla-E0 for pgsql-bugs@lists.postgresql.org; Thu, 24 Aug 2023 20:23:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fUP0lVrHodA2qlro6j7/fj8yeOZLJVU4qbNTlMvH6OsC0Aeg1QnEu+c6thPFrYV9Zn4UapiRmXKCMCQ+EstTMup9fLFRhInA+O6HlGEav7jr6UFhuUyou7kuTlQCOSn5xmNZt5t0Sjka6rI0dj7/4QDPRHXxKAPN4MK69Iq/ksJXGXlT1jtUdoqg639d2U7RtBFqEgmkVWg0uEKDBmA8rvpJA9WGR31XxzGtMJdUjc3WAtNndR3CETCKdq10pyRSCoQaOE59NW4imR8bSYh28CAo9exZkX5/4eBJQ86KsM51OlEIk+BdPIWYMmgDzy8XOC4scNtaq636lKIeDbiW5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d2MEEQZPhTAfzUiGH/qq6Kt7QU2X4dwJtYVkfEFZg3w=; b=gAuho/88udx3KEPAe84h+cbxSDzvlmZ4439dsgvOvD9sDIdGTRHOpINXcxzOhcE/uvWu8/w8/wzaB5TAdeJuyPONoUGB2fyvOU+l+yM3Y9CoFpxz6FzK4jVc/RD2ZIGHYfOwiFc2mD0egalLE6FKVwwFk3AS1DMf5rP9XDUl0fWZ6DpuBrHDT441DbO6opQcR+52yfGjR+GTbkt93VeO1acWbQ7JDt1Z8KKgDWm0l5EHSzl92T6p99OuQjWm7MyctHROrVCvimdz2xzXJYSeiJMesmwqiZdUYvS29PaJn5lvOuK7DU7kSdMZiQk72dxDIEt+puMxMxwTIczvbzWqdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ascentech.ca; dmarc=pass action=none header.from=ascentech.ca; dkim=pass header.d=ascentech.ca; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ascentech.onmicrosoft.com; s=selector2-ascentech-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d2MEEQZPhTAfzUiGH/qq6Kt7QU2X4dwJtYVkfEFZg3w=; b=PpRzjMF8Ml1SfIeyGka0uQPrYMrC/qazT3QNd3rTcp4zH7oDg7bMcbhP2qdc9QFr3W1CV8AsaOcSYC3oKW69i/F0vZ19Somxy9xPtLZASWVZcEyF7Xnfr+FN+nlEVXpH8kFW3My4h5WSJCjKxXyXf1eg6GlbOGTFmA53MNOe0KI= Received: from YT2PR01MB4318.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:36::24) by YQBPR01MB10829.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:79::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Thu, 24 Aug 2023 20:23:00 +0000 Received: from YT2PR01MB4318.CANPRD01.PROD.OUTLOOK.COM ([fe80::6c58:896f:ef6e:931f]) by YT2PR01MB4318.CANPRD01.PROD.OUTLOOK.COM ([fe80::6c58:896f:ef6e:931f%4]) with mapi id 15.20.6699.027; Thu, 24 Aug 2023 20:23:00 +0000 From: Jonathan Zacharuk To: Tom Lane CC: "pgsql-bugs@lists.postgresql.org" Subject: RE: Error when using unquoted identifier that contains the word end in a begin atomic block Thread-Topic: Error when using unquoted identifier that contains the word end in a begin atomic block Thread-Index: AdnWxHDKIppFRA9nQPO79TBS4BBUrAAAtwIAAABG5jA= Date: Thu, 24 Aug 2023 20:23:00 +0000 Message-ID: References: <3972353.1692907946@sss.pgh.pa.us> In-Reply-To: <3972353.1692907946@sss.pgh.pa.us> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ascentech.ca; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: YT2PR01MB4318:EE_|YQBPR01MB10829:EE_ x-ms-office365-filtering-correlation-id: 9fbe2957-5afa-43f2-7dda-08dba4dfe954 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xKVi18a0a7ATjKdykAP5REbYX+yhLtK13bxqr0YBIT3WexohUo+n3hB/22Kme/Fbr7JnKXXY8IaAW2cAR0rQGQHJ6886SMKIUa7OLruK1gGb0yaNoWmnlWa05bUg7OXWuqQqY830nc0G/Y6JlWk7y3Z17iL5o6WDcJ10CZ6FaiSRk50+Gq+LBMcP5Ga1UKesLxS4AnWYZY6/aJ7+Ucm1vkFMRjulpbeyHEQGAIf0oJlCnHnC2svALAqox5puWf4uPbnX1g91yWHql9VTeexwYl/jTZ/6hyQfiam9/9961i1FxWXiTErPYzuBKbc75D4ABz4AtjwxwOl++k7Z3uHD1VysT5uWmYaSPAeHhvTBSeg15Snaq6i572AEds/6BAZu76BO28+x6rpNGvOawTf5/7wtQewSD+rOt0zH9Woel8pLFrjaBk+gEehmkGvStSBWzBF4LAsFtPiU6BD87QYeQzQkAgaYCefmT8F+K/gTD1XOhDt9dyt53T6k/pJMT+9hlW9hesbVtS+kI5wsA/4TsH36i1ZpknAn3unWaR8YBNKyhkgG+VJ2b+sBXTIsS1e5H0UqHlrnZvJ9/GTBDMBcMpwqFmwHZH0wzQOS8ngakJB5Wjqkslt2UOyUShHUotvB x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT2PR01MB4318.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(366004)(39830400003)(376002)(136003)(396003)(346002)(186009)(1800799009)(451199024)(66446008)(66476007)(64756008)(66946007)(76116006)(66556008)(316002)(6916009)(122000001)(478600001)(26005)(55016003)(38070700005)(38100700002)(33656002)(71200400001)(41300700001)(53546011)(6506007)(7696005)(86362001)(2906002)(9686003)(4326008)(8676002)(8936002)(83380400001)(52536014)(5660300002)(44832011);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?k31jJWl6B5zais2/0Tc5BKY7M7euavMe5E2R/zjEcGcQV9zrZsfFZCJGYJ25?= =?us-ascii?Q?gJVCay8J5SYxe1UQCYA3MSRCTOVyuxFnGvpB2I/0XtX2ZWGcXZcmhrHKkNzQ?= =?us-ascii?Q?Jrh4TF4YBGch+L2EUfktRsEXMOsJbsbDypyhU7ozGCo+uMjptKoprWpQb/+k?= =?us-ascii?Q?P8BWNJ4Gz1Z1rMPe/7lVORTleI1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O+43EW0T7ONXgfOqhKxMB8oJ2EJq7siqMJKbVrBp4fbKyvf0AsNg?= =?us-ascii?Q?sTvKAyTNtga0lZXzT/qN/EBf2gJ5gIxwEx5XDzvJiNql+OwGxolhNICpS8hk?= =?us-ascii?Q?HZqM6/Jl4bW9fQAe8FEkpE8+YxjzAVcbgTuzWnae+fEG5g6HHrWAVmU+DUyX?= =?us-ascii?Q?HyDmkzhkoE0velkBVyIQrMjVBGinbeeOq3MdlInrTalVthGGgifW6n5M2FN6?= =?us-ascii?Q?SL7pPyOXiLTx40Ymi2Ak5L70nRWHSOx6EHvI1MTGzxL5VIVevluFHESYcdSr?= =?us-ascii?Q?6QuJ5onCn+yLkqi5zAIl4czrGnvMPegg8jsi+DLPl36GGrWwVRnItGE/ufPd?= =?us-ascii?Q?OPaTH9Vhp5YNCCoUXEoPMnZmqCYC/YhXtH9qGLwT6DAht4QjkMmEkmfYXlTb?= =?us-ascii?Q?lBqKLsDy+8T03FUiMsq7HZwNhBk6pSSIHUwQwIl1fZ4FKq7KrFmM1BCR9/kN?= =?us-ascii?Q?CbqAHajlamW538LkVZKOlxOoO55PACWclPejkys6DpgeZ43Iar4yb8BdLDeh?= =?us-ascii?Q?0Q=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: ascentech.ca X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: YT2PR01MB4318.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 9fbe2957-5afa-43f2-7dda-08dba4dfe954 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Aug 2023 20:23:00.2339 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: fc2627e6-54d9-4d18-8ad4-f9ce7ae64cab X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qKQA6Ft9+6U0nVQ6xmfSfh/7VhBYZKsh7aG+Eh3xNgrbikR+XBVqwlL5H7N6iCGYm7+mubIMdF1VXAs6JUy0avmmbdM1N62Sqf4GkNiI1ow= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQBPR01MB10829 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thanks Tom. I should have noticed that the command I was running was not co= mpletely getting sent to the server. This does indeed look like a Navicat i= ssue. I have confirmed with psql that this works fine and will ensure to do= so in the future! -----Original Message----- From: Tom Lane =20 Sent: Thursday, August 24, 2023 1:12 PM To: Jonathan Zacharuk Cc: pgsql-bugs@lists.postgresql.org Subject: Re: Error when using unquoted identifier that contains the word en= d in a begin atomic block Jonathan Zacharuk writes: > It seems to me that within a BEGIN ATOMIC block the use of the word "end"= within an unquoted identifier is causing an error. I think your problem is somewhere on the client side. > -- This function is successfully created (note the quoted "effective_end_= date"). > CREATE OR REPLACE FUNCTION test_function_success() RETURNS TIMESTAMP=20 > LANGUAGE SQL BEGIN ATOMIC > SELECT DISTINCT "effective_end_date" > FROM test_view; > END For me, this works (in psql) with or without the double quotes: regression=3D# CREATE OR REPLACE FUNCTION test_function_success() RETURNS T= IMESTAMP LANGUAGE SQL BEGIN ATOMIC SELECT DISTINCT "effective_end_date" FROM test_view; END; CREATE FUNCTION regression=3D# CREATE OR REPLACE FUNCTION test_function_success() RETURNS T= IMESTAMP LANGUAGE SQL BEGIN ATOMIC SELECT DISTINCT effective_end_date FROM test_view; END; CREATE FUNCTION > -- This function fails to be created. I would expect this to work. > CREATE OR REPLACE FUNCTION test_function_fail() RETURNS TIMESTAMP=20 > LANGUAGE SQL BEGIN ATOMIC > SELECT DISTINCT effective_end_date > FROM test_view > ERROR: syntax error at end of input > LINE 6: FROM test_view > ^ I can't help noticing that the trailing END is missing from what you show h= ere, and it seems pretty clear that the syntax error is about that, not abo= ut the effective_end_date identifier. So the real question is why the CREA= TE FUNCTION command is getting sent to the server before it's complete. If= this isn't flat-out pilot error, then I guess whatever client you are usin= g (apparently not psql) is getting confused about which occurrence of "end"= terminates the command. You should take this up with the authors of said = client software. regards, tom lane