Skip to content

Postgres dbName on deep array field regression #12136

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

Open
Rymar opened this issue Apr 16, 2025 · 0 comments · May be fixed by #12237
Open

Postgres dbName on deep array field regression #12136

Rymar opened this issue Apr 16, 2025 · 0 comments · May be fixed by #12237
Assignees

Comments

@Rymar
Copy link

Rymar commented Apr 16, 2025

Describe the Bug

After upgrading version from 3.33.0 to 3.34.0 deeply nested array fields stopped working. Error happens on Postgres, haven't checked other databases.

import type { GlobalConfig } from 'payload';

export const Header: GlobalConfig = {
  slug: 'header',
  fields: [
    {
      name: 'itemsLvl1',
      type: 'array',
      dbName: 'header_items_lvl1',
      fields: [
        {
          name: 'label',
          type: 'text',
        },
        {
          name: 'itemsLvl2',
          type: 'array',
          dbName: 'header_items_lvl2',
          fields: [
            {
              name: 'label',
              type: 'text',
            },
            {
              name: 'itemsLvl3',
              type: 'array',
              dbName: 'header_items_lvl3',
              fields: [
                {
                  name: 'label',
                  type: 'text',
                },
                {
                  name: 'itemsLvl4',
                  type: 'array',
                  dbName: 'header_items_lvl4',
                  fields: [
                    {
                      name: 'label',
                      type: 'text',
                    },
                  ],
                },
              ],
            },
          ],
        },
      ],
    },
  ],
}

Error:

error: table name "header__header_items_lvl1__header_items_lvl2__header_items_lvl3" specified more than once

When i change version to 3.33.0 or i remove 2 last levels it starts to work again.

Might be related to #11995.

Link to the code that reproduces this issue

https://github.com/Rymar/payload-deep-dbname

Reproduction Steps

Open home page from linked repo. It makes

await payload.findGlobal({
  slug: "header",
});

result
Image

Which area(s) are affected? (Select all that apply)

db-postgres

Environment Info

Payload 3.34.0
Next 15.3.0
Postgres database
@Rymar Rymar added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. labels Apr 16, 2025
@github-actions github-actions bot removed the validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. label Apr 16, 2025
@r1tsuu r1tsuu self-assigned this Apr 28, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants