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

Indexes on text fields are throwing on large submissions #8787

Closed
max-degterev opened this issue Oct 18, 2024 · 2 comments
Closed

Indexes on text fields are throwing on large submissions #8787

max-degterev opened this issue Oct 18, 2024 · 2 comments
Labels

Comments

@max-degterev
Copy link

max-degterev commented Oct 18, 2024

Link to reproduction

No response

Describe the Bug

If you have a text field with an index and try to save a large chunk of text you get this error:

[12:17:18] ERROR (payload): POST /sites/:id/entries
    err: {
      "type": "DatabaseError",
      "message": "index row size 3136 exceeds btree version 4 maximum 2704 for index \"e_texts_value_idx\"",
      "stack":
          error: index row size 3136 exceeds btree version 4 maximum 2704 for index "e_texts_value_idx"
              at /home/node/app/node_modules/pg/lib/client.js:526:17
              at processTicksAndRejections (node:internal/process/task_queues:95:5)
              at /home/node/app/node_modules/src/node-postgres/session.ts:66:19
              at insertArrays (/home/node/app/node_modules/@payloadcms/db-postgres/src/upsertRow/insertArrays.ts:73:22)
              at upsertRow (/home/node/app/node_modules/@payloadcms/db-postgres/src/upsertRow/index.ts:291:5)
              at Object.create (/home/node/app/node_modules/@payloadcms/db-postgres/src/create.ts:17:18)
              at create (/home/node/app/node_modules/payload/src/collections/operations/create.ts:253:15)
              at handler (/endpoints/entries/index.ts:190:23)
      "length": 390,
      "name": "error",
      "severity": "ERROR",
      "code": "54000",
      "detail": "Index row references tuple (40,1) in relation \"e_texts\".",
      "hint": "Values larger than 1/3 of a buffer page cannot be indexed.\nConsider a function index of an MD5 hash of the value, or use full text indexing.",
      "schema": "public",
      "table": "e_texts",
      "constraint": "e_texts_value_idx",
      "file": "nbtutils.c",
      "line": "2675",
      "routine": "_bt_check_third_page"
    }

I don't think there is a way to patch this outside of payload/drizzle. Any chance you could include additional index configuration for this usecase? Atm text field indexes are only working for short content fields.

To Reproduce

Use text field with an index, submit a large chunk of text

Payload Version

latest v2

Adapters and Plugins

No response

@max-degterev max-degterev added status: needs-triage Possible bug which hasn't been reproduced yet v2 labels Oct 18, 2024
@DanRibbens
Copy link
Contributor

This should be possible in @beta since we added afterInitSchema which will be the only way to customize your index.

We don't have a plan to backport that to 2.0 at this time.

@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 18, 2024
Copy link
Contributor

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants