Postgres do not allow to create many tables with more than 63-symbols prefix

Lists: pgsql-bugs
From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Cc: d(dot)koval(at)postgrespro(dot)ru
Subject: Postgres do not allow to create many tables with more than 63-symbols prefix
Date: 2022-06-03 19:02:56
Message-ID: [email protected]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

According to subj you can try to create many tables (induced by the case
of partitioned table) with long prefix - see 6727v.sql for reproduction.
But now it's impossible because of logic of the makeUniqueTypeName()
routine.
You get the error:
ERROR: could not form array type name for type ...

It is very corner case, of course. But solution is easy and short. So,
why not to fix? - See the patch in attachment.

--
regards,
Andrey Lepikhov
Postgres Professional

Attachment Content-Type Size
6727v.sql application/sql 397 bytes
0001-Allow-postgresql-to-generate-more-relations-with-the.patch text/plain 3.6 KB

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, d(dot)koval(at)postgrespro(dot)ru
Subject: Re: Postgres do not allow to create many tables with more than 63-symbols prefix
Date: 2022-06-23 02:03:33
Message-ID: CAD21AoC5wt6iCFK5uMRTTYT3be09RWi9a3YduKXUqsFbTKby_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hi,

On Sat, Jun 4, 2022 at 4:03 AM Andrey Lepikhov
<a(dot)lepikhov(at)postgrespro(dot)ru> wrote:
>
> According to subj you can try to create many tables (induced by the case
> of partitioned table) with long prefix - see 6727v.sql for reproduction.
> But now it's impossible because of logic of the makeUniqueTypeName()
> routine.
> You get the error:
> ERROR: could not form array type name for type ...
>
> It is very corner case, of course. But solution is easy and short. So,
> why not to fix? - See the patch in attachment.

While this seems to be a good improvement, I think it's not a bug.
Probably we cannot backpatch it as it will end up having type names
defined by different naming rules. I'd suggest discussing it on
-hackers.

Regarding the patch, I think we can merge makeUniqueTypeName() to
makeArrayTypeName() as there is no caller of makeUniqueTypeName() who
pass tryOriginal = true. Also looking at other ChooseXXXName()
functions, we don't care about integer overflow. Is it better to make
it consistent with them?

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/