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 1ubYV7-002HIM-7P for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 05:46:49 +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 1ubYV5-00H9TP-1v for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 05:46:47 +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 1ubYV4-00H9TH-NY for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 05:46:47 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ubYV3-007M8F-2R for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 05:46:46 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-455ecacfc32so15458805e9.3 for ; Mon, 14 Jul 2025 22:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1752558404; x=1753163204; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=xJDDV16WSdnBoLHrq01IdBGgp17mEzZ3Ky4MDcGMqtw=; b=B8x8KxjKhPryZYXmNkZ8rlvfiRyZzaLtmqjbT7BJ7v9aOxVnB8MIi1nleRJgoeHHMC 5xw4tM/wE/kI+oebPBi5h/6xDgRfXpNcSx82yy55JTZgHxQ3DIkIQ/WV66Norg7l0u7o 88nRs6pvk3E6Yrus77JXAJfjTZDLoeX51vT4w0LmmluBddbgwVXsZtTfhM4jvUrFZ+xE WoIlsidV9I36/xwd4TxQyeuw1FGxrBnWQe3l4C7H9Jht13iSSkQH8qdiOrTHHu53TzZU XIouC9WhpoHP6MtSSegRGhtgvq3DxuWLUt1uTWsY61vnI/nmVZ2F7j5dhmXmI2SNS4g4 6EHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752558404; x=1753163204; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xJDDV16WSdnBoLHrq01IdBGgp17mEzZ3Ky4MDcGMqtw=; b=ehQQSNw2Dxassvg0huxzpCiiXL/YwPLTQurBqfyGP2bWjex8NznMhltNEj+R9Og4bt ikG7FPVzDubrMCwQYbqoP1f1YzXBTtG+a7hLpUj2NKi+SxWO+sV1ef7MnngBWCY8tJkG uRm6RapfgwmR9fqZ+1fFAYCztoEsoidiqKla6KrF7aWnYPWE4SLmBu3KatDbqTfYUQHV 8In0Ns7UMMdgIjVpPIfF+IQ4uzDzwCA2CEHgUZqAPGj8FU9F1tM/3Ydg33mMzFtZlbRJ wRE0B4KX3jbM1ED+JRF+oFAptH7dsV/tbB/s857fxIkpQB7X+J+KwMjq3XMo9y1zU1SR 5EFA== X-Forwarded-Encrypted: i=1; AJvYcCUdkd9/gRUAkiWEZpFUMJgdFBClURGM/GMkixPpq2QJ/Y4QI+NKPoGrXIL6byod2aNoabADMZsxZZchwzQB@lists.postgresql.org X-Gm-Message-State: AOJu0YztSi6ElUhCToO0L9Rw+d/kuuPv+yzeZLmMpxPdl7e9v6oGUVhV kqpFOd+GIaUK9n1RcCdZ87u3Ppb72k2cX9IC7FDr+61M6WN3eFuSE10yEhjHbrToy2EFGlwUyme Sk2I3 X-Gm-Gg: ASbGncvgtTJdkYaVJqw6IcNMWjdykGZRBReFCAEyi5DF/6+6wntYmYEvGtFzhkVtAwe 00rM8JPgD1tOuRTnX1MpsOUvmxwnrUA7pJDn2wcjtEhjvcztt9hDKUFlM1eWSRhtjj8v7neHqpr N+2OLLQlxXt4hdiMRjJio1E280IZXOzGVNYVqJEBSJOWWlm59p1XODGj3gFQj4dgTFn6dDykwW3 BtNkSM1qRZIzu2C5+7zM7iSslFDFZGSYd88MENBP0eT0uXfK377D51muTuwboNlGWf8gH26n5xi miMvkioCbP0SKGouOHhm9l4aETIulDRjboUQ8perPqZFwLiDxlO7LUtO+gOen8GNzuV9nZaKR4g cZU7boSbD/vyxATjacRuocRDls1OwFU8xMMng7modtAOw+qA1cSAG X-Google-Smtp-Source: AGHT+IHHM9d5UkAoax5hx4fE7Ac4vLNwYBI7h50KFg2CBWUHWQm8RNqcdQA0b26+tflltWHE0CRehg== X-Received: by 2002:a05:600d:2388:b0:455:bd8a:7e7 with SMTP id 5b1f17b1804b1-455bd8a0a0amr81909645e9.9.1752558404387; Mon, 14 Jul 2025 22:46:44 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:260:6670:8653:2e94:b4f9:98f9]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b5e8e14d07sm14372260f8f.66.2025.07.14.22.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 22:46:44 -0700 (PDT) Message-ID: Subject: Re: Syntax error needs explanation [RESOLVED] From: Laurenz Albe To: Rich Shepard , pgsql-general@lists.postgresql.org Date: Tue, 15 Jul 2025 07:46:43 +0200 In-Reply-To: <9c62a6d5-14a-802-b869-6386d7e050fb@appl-ecosys.com> References: <9c84776d-d938-9fa4-ab1-6ee960ce6e7d@appl-ecosys.com> <9c62a6d5-14a-802-b869-6386d7e050fb@appl-ecosys.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-1.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2025-07-14 at 12:19 -0700, Rich Shepard wrote: > On Mon, 14 Jul 2025, David G. Johnston wrote: >=20 > > The error indicates your script file is at least 127 lines long and you > > are showing like 9...also do you usually name your script files with a > > .txt extension? >=20 > Agh! No the filename extension is .sql. But I was using the \o psql optio= n > to write script output to files and mistyped the script name. >=20 > Mea culpa! Apart from that, the subquery seems to be missing a GROUP BY clause. Yours, Laurenz Albe