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 1u5PUg-00HSHL-4W for pgsql-general@arkaria.postgresql.org; Thu, 17 Apr 2025 13:41:30 +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 1u5PUd-008EQ4-NV for pgsql-general@arkaria.postgresql.org; Thu, 17 Apr 2025 13:41:28 +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 1u5PUd-008EPw-Ad for pgsql-general@lists.postgresql.org; Thu, 17 Apr 2025 13:41:28 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u5PUa-000Zgl-1F for pgsql-general@lists.postgresql.org; Thu, 17 Apr 2025 13:41:27 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43edecbfb46so5887085e9.0 for ; Thu, 17 Apr 2025 06:41:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1744897284; x=1745502084; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=+bQRZ80g1i46i8L3NvgS6jmlf+xlTcuZzHFfoWNhjHg=; b=Huv5qxZ1qJtcLk2W4d+FyUgXmeOaIHUQlLtD7CAqk9dIgy8JcJIs2iZtAGorN63gLe dXs1AbbJP7NPh+ax2qMvKA77aE46xj8av4l6bVDBYB30ZqKl3v9uyLXxloqRUFepNX2k PcIBdjRT3To/TW73ioXlpqLFhprhPQNb+3bMino4Vz7+u7M7JIc6gjFBhOd4iGXf4+B6 rE/8yMMvmwefTv9sbCChyWKYhMR5VQqeyB9zORdq6YuB+X6q6YVwHrz9OLZBiHZZa9oP +HBHdZ5TJH+5bbi7CkR+U7xeKt24UXL3+ZcgaN/CzDi7B8XC4DghrQpbt3elXzXc87FP NPxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744897284; x=1745502084; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+bQRZ80g1i46i8L3NvgS6jmlf+xlTcuZzHFfoWNhjHg=; b=gV+mrD35q/jjUdw5Kaes9+5c/CBNX66mde8bRhA9lOG+dGdw4Tkhv3YQdB5+nLwQ16 qqHWSRzhGxvv99SO8MWhRdj4uFOab/vpu1smB0DAbHatgfcBOe1xeWGaSDzgMeWncshF /m8rzL9/ZWyuV10UvBeuYDbJzDanBH4MRGPs8c2M7FaLHwYCnwJD2z7uDWYUlgHjaWRO grgHsMM/Cs96JhRCmOAeWq18HVB6Um2SvMbuja03AuX3/jYPva/VAfJ4pUPwGEizDXot 4tvqo6uVSIt6sVJgNjhWpKp7PIAyKsl6r2mWptqUGte6nFJFMKOftm5aj6MT34hxJOtL njHg== X-Forwarded-Encrypted: i=1; AJvYcCVbHS+fDDGQGPIvlmFZ172hQVVPukmeNbUX7aLHep10ga5iyunjFsWJCSvIzzuENk8h24HgZOOkvjRxOxnm@lists.postgresql.org X-Gm-Message-State: AOJu0Yzm04HdQtBlGptxQ/JSUdchnSl2MXRj9s4WGbIyzDMm88kNJCmD Bq3/hJLnkrOCivdHqxzcTuvcUUXXxuwVT2CoFOiNuMAo/VIM6HG7pOkvwwWbfOo= X-Gm-Gg: ASbGncubtw+lHc4YqOzyV2Qqn7L38BwWl5qOnEpObDOixKl8iPhcXbNjssfsocriD6Q zHbEQOJh3AaN7EhFxng1XY9PRaRewSpEruZ6TJYkxg75mJXH+B00H2ky/Dsa/IoldC7vEWNl1oO 7B4xcN9/5RVD1zVAY6KH4tw6ur1+jGcQkbQECIXX+TXJJRdHvGQkBQorFHouSwgsodv1Uin/pWZ 2E0abJJpQ2LpDAvdCdGpEv8im9ASJCjDaYV5WeZJVS9uFB5smNe1T2NYhZESzKP0JgzJQjAo8O/ xX/HMLove1DLFy3dbXDmUIQ6pxk+Ubeu7TQP+1D2I468G0Hx9XwNlh8n9c45mA== X-Google-Smtp-Source: AGHT+IFXd3BXQjGS/J9nFumBin9+ldQCdTM8V/MDp3pScDd1RgpeVjlAYMK4PvU241QY+SQSsnm5Uw== X-Received: by 2002:a05:600c:384b:b0:43c:f629:66f4 with SMTP id 5b1f17b1804b1-4405d5bdf96mr62453725e9.0.1744897280941; Thu, 17 Apr 2025 06:41:20 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:5373:9d9a:af04:78c5:75aa]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4405b4c8216sm55052775e9.7.2025.04.17.06.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Apr 2025 06:41:20 -0700 (PDT) Message-ID: <237d58a65d887376ded17a67e7b99af5936fa9a3.camel@cybertec.at> Subject: Re: Request for official clarification on SQL parameter parsing changes in PostgreSQL 15 and 16 From: Laurenz Albe To: =?UTF-8?Q?=E7=8E=8B=E3=80=80=E5=8D=9A?= , "pgsql-general@lists.postgresql.org" Cc: =?UTF-8?Q?=E6=9D=8E=E3=80=80=E6=B5=A9?= Date: Thu, 17 Apr 2025 15:41:19 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-04-17 at 05:17 +0000, =E7=8E=8B=E3=80=80=E5=8D=9A wrote: > We have encountered unexpected SQL parsing errors during application upgr= ades from > PostgreSQL 14 to 15 and 16, related to the use of JDBC-style parameter > placeholders (`?`) in our legacy applications. > =C2=A0 > Specifically: > =C2=A0 > 1. In PostgreSQL 15 and later: > =C2=A0=C2=A0 The following SQL causes a syntax error unless a space is ad= ded after the `?`: > =C2=A0=C2=A0=C2=A0=C2=A0 SELECT * FROM table WHERE a =3D ?AND b =3D 123; > =C2=A0=C2=A0 =E2=86=92 Adding a space (`? AND`) resolves the issue. > =C2=A0=C2=A0 This did not cause an error in PostgreSQL 14. > =C2=A0 > 2. In PostgreSQL 16: > =C2=A0=C2=A0 The following SQL causes a syntax error: > =C2=A0=C2=A0=C2=A0=C2=A0 SELECT * FROM table WHERE a =3D ?ORDER BY b; > =C2=A0=C2=A0 =E2=86=92 This query runs in PostgreSQL 15, but causes an er= ror in 16 unless a space is added after `?`. > =C2=A0 > We understand that this behavior may stem from changes to the parser to m= ake it more > strict and SQL-compliant. However, we were unable to find any explicit me= ntion of these > changes in the official release notes of PostgreSQL 15 or 16. > =C2=A0 > Our client is asking for official documentation or a statement confirming= whether this > behavior change was intentional and when it was introduced. > =C2=A0 > Could anyone kindly point us to: > - Relevant release note sections, commits, or discussions on this change > - Confirmation that these are intentional parser changes (and not regress= ions) I'd say it is this change: https://postgr.es/c/2549f0661bd28571d7200d6f82f752a7ee5d47e1 The mailing list discussion is here: https://www.postgresql.org/message-id/flat/b239564c-cad0-b23e-c57e-166d883c= b97d@enterprisedb.com Yours, Laurenz Albe