Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fuexF-0003H3-HZ for pgsql-docs@arkaria.postgresql.org; Tue, 28 Aug 2018 14:26:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fuexD-0006DS-CI for pgsql-docs@arkaria.postgresql.org; Tue, 28 Aug 2018 14:26:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fuexD-0006DL-4V for pgsql-docs@lists.postgresql.org; Tue, 28 Aug 2018 14:26:47 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fuex8-0004Lp-Go for pgsql-docs@postgresql.org; Tue, 28 Aug 2018 14:26:46 +0000 Received: by mail-ed1-x52c.google.com with SMTP id p52-v6so1513545eda.12 for ; Tue, 28 Aug 2018 07:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=0fo5bXRgyCe4C19h6M+1ycDjNjX7cw/ea0xQl4KOcDE=; b=cKuCpcRFh5h1yce5yQmM+fQqzq3Hd6eS86W78tIziEG9W9euN3V0SsMaSIaQZDzvIX 8Ag9/SCC+YGSfhY1JMOelLGxV96q622ZfzXdw59YmmK7+qI+nlOw1slHE/6ajjaPSyib Ic7/dFbX4o9vYHFpN/5VDJQ0e3gukyDsUe9s9WhWxoN4hmQaq6zuQS0okGP0wx4fmm9X X13tSMWZkNHyL1YO+S3fND0GVQlM4VHcfjcOSO7fiLeo5z6yzfdSjrebVaEuVLMK1kPI iYu1HiGzz5bupVVv0AYlMoDA9d9L0t3SW0AEBtBCklvG9rqlCwmMm15FL5JHgIozgrd6 upcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=0fo5bXRgyCe4C19h6M+1ycDjNjX7cw/ea0xQl4KOcDE=; b=PMFXqaONzmW54Baqilt0i2CQ8LpFHmUvMCoyOLfHeogVikb8JAVyF9g8OawYO3LIpF iREe6FifV7u/FkldFsfAZqXHdNu9FSDVNkAwpJ9O/nIowJZvidaHIkDiEEcP1VPnX/PZ qIl/Or3F+4Ui2mpVtjuGdN1VfFcJGUx/E+sn0kyyYdlgwvJhn+dmkDSUUsQtFRVUzhhg Wj7F9ITqe6755THigkBQ/6DBErEQWwu9KsCvUa4MC490WBi6ee5cccCQ3mV29hxb7jS0 kXjfv9qubZ2smEK/xiUw9yquQ011r94Ck/jKixJ6LC9lonO16tZL1LSu82RAFR/IX2bU fhow== X-Gm-Message-State: APzg51CHuagrUThhEQPcS9TxRvcqAAmq1kB+TpYceHP04YGYmgL73s47 Blr4MIWPNST+bEb+B9EBEdMvMFt/6RMAMIBO1Rh3gQ== X-Google-Smtp-Source: ANB0VdYjdqhXe6ShfmnSBVBq+WbPJskDGluUUoAr5cOC/DSfkobwejPBlC/jDYmsgvk+ZllhbT6XqNXoUdaLNJjrAAQ= X-Received: by 2002:a50:f419:: with SMTP id r25-v6mr2793242edm.226.1535466401414; Tue, 28 Aug 2018 07:26:41 -0700 (PDT) MIME-Version: 1.0 From: Flavio Henrique Araque Gurgel Date: Tue, 28 Aug 2018 16:26:30 +0200 Message-ID: Subject: Limitation of prepared statement name To: pgsql-docs@postgresql.org Content-Type: multipart/alternative; boundary="0000000000006bc3bd05747fa108" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --0000000000006bc3bd05747fa108 Content-Type: text/plain; charset="UTF-8" Hello all I just found a limitation in prepared statements names that I didn't know before and can lead applications to be difficult to debug. It seems that naming prepared statements is limited to 63 characters as per https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS However, the documentation for PREPARE says nothing about it https://www.postgresql.org/docs/10/static/sql-prepare.html The dangerous situation is that PostgreSQL seems to ignore rigthmost overflowed characters silently. If we try to prepare another statement with the same 63 leftmost characters as the first one, we get an error of duplicate prepared statement name. Wouldn't it be good to include that information on the prepared statement doc page? Maybe I should notify this as a general bug so we treat this at the code level. Best, Flavio Gurgel --0000000000006bc3bd05747fa108 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello all

I just found a lim= itation in prepared statements names that I didn't know before and can = lead applications to be difficult to debug.

It see= ms that naming prepared statements is limited to 63 characters as per https://www.postgresql.org/docs/current/static/sq= l-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

H= owever, the documentation for PREPARE says nothing about it https://www.postgre= sql.org/docs/10/static/sql-prepare.html

The da= ngerous situation is that PostgreSQL seems to ignore rigthmost overflowed c= haracters silently. If we try to prepare another statement with the same 63= leftmost characters as the first one, we get an error of duplicate prepare= d statement name.

Wouldn't it be good to inclu= de that information on the prepared statement doc page? Maybe I should noti= fy this as a general bug so we treat this at the code level.

=
Best,
Flavio Gurgel

--0000000000006bc3bd05747fa108--