Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres Index Name too long #5973

Open
javve opened this issue Apr 23, 2024 · 1 comment
Open

Postgres Index Name too long #5973

javve opened this issue Apr 23, 2024 · 1 comment
Assignees
Labels
[possible-bug] Possible bug which hasn't been reproduced yet

Comments

@javve
Copy link

javve commented Apr 23, 2024

Link to reproduction

No response

Describe the Bug

Payload asked me this question, and even if I accepted, I still got the message the next time I restarted the server.

You're about to add pages_blocks_highlight_list_block_locales_locale_parent_id_unique 
unique constraint to the table, which contains 4 items. 
If this statement fails, you will receive an error from the database. 
Do you want to truncate pages_blocks_highlight_list_block_locales table?

It turns out that Postgres index name is a maximum of 63 characters long.
https://til.hashrocket.com/posts/8f87c65a0a-postgresqls-max-identifier-length-is-63-bytes
https://www.postgresql.org/message-id/3D4DF3EE.7070807@mega-bucks.co.jp

So, in this case, an index named pages_blocks_highlight_list_block_locales_locale_parent_id_uni (note the missing chars) was created, but Payload did not realise this, so it continued to ask me the same question over and over.

To Reproduce

I think it should be enough to add a block in a table with a name longer than 63 characters.

Payload Version

2.12.1

Adapters and Plugins

db-postgres

@javve javve added the [possible-bug] Possible bug which hasn't been reproduced yet label Apr 23, 2024
@madaxen86
Copy link

Thanks, this helped me figure out a workaround by shorten the field names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[possible-bug] Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

3 participants