Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TaELo-0004Xd-Cb for pgsql-general@postgresql.org; Sun, 18 Nov 2012 23:32:32 +0000 Received: from sneak2.sneakemail.com ([38.113.6.65]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TaELg-0004Eq-W6 for pgsql-general@postgresql.org; Sun, 18 Nov 2012 23:32:28 +0000 Received: (qmail 10126 invoked from network); 18 Nov 2012 23:32:18 -0000 Received: from unknown (HELO localhost.localdomain) (192.168.0.1) by sneak2.sneakemail.com with SMTP; 18 Nov 2012 23:32:18 -0000 Received: from 61.9.189.149 by mail.sneakemail.com with SMTP; 18 Nov 2012 23:32:18 -0000 Received: (sneakemail censored 12628-1353281537-663381 #2); 18 Nov 2012 23:32:18 -0000 Received: (sneakemail censored 12628-1353281537-663381 #1); 18 Nov 2012 23:32:18 -0000 Date: Mon, 19 Nov 2012 10:32:12 +1100 From: Gavan Schneider Subject: Re: [BUGS] Prepared Statement Name Truncation To: pgsql-general@postgresql.org In-Reply-To: <20152C83-CD88-4725-A790-0B32305751AE@yahoo.com> Message-ID: <12628-1353281537-663381@sneakemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailer: Perl5 Mail::Internet v X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201211/562 X-Sequence-Number: 192404 On Sunday, November 18, 2012 at 01:10, David Johnston wrote: >=20 > Can the system be made smart enough to not allow intra-schema > collisions in addition to same schema ones? That would seem to be the > area of greatest concern - particularly around the usage of > truncate/delete/drop. >=20 >=20 My summary FWIW: 1. Potential exists for internally generated names to exceed maxlen; and 2. this maxlen is shorter than the SQL standard specification; but 3. it may not be worth the performance hit to be SQL compliant in this; wit= h 4. potential for (undetected) name collision and unintended consequences. May I suggest an idea from the days when memory was counted in (tiny int) k= B: represent the over maxlen identifiers "as is" up to maxlen-8 bytes use those last 8 bytes for a 40bit hash in Base32 for disambiguation and, if 1:10^^12 residual collision risk is considered too high a side list of overlong names would allow for a second hash disambiguat= ion process. Notes: 1. The choice of Base32 encoding may be a matter of personal preference , and, if so, I suggest using the Crockford encoding . (I am impressed his design is excellent, while also averting some accidental obscenities. None of the others offer this feature :) 2. Something along these lines, with the side table to track the (hopefully) occasional overlong identifiers, could give standards compliance in identifier length while still keeping the working tables compact. 3. (Wild speculation) There may be a "sweet spot" using even shorter identifiers than is the case now, with full disambiguation, which might improve overall performance. Regards Gavan Schneider