payloadcms / payloadcms/payload

SQL query error when fetching collection using the latest localization parameters

Open
#15,248 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: core Bug db: postgres stale status: needs-triage
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

When using the new localizeStatus: true feature with drafts enabled, querying a collection that has a join field with draft: true and a locale parameter generates an invalid SQL query, causing PostgreSQL error: invalid reference to FROM-clause entry for table "_r_v".

Workarounds ( either will fix the test )

  • Comment out localizeStatus: true line
  • Change name to label in the tabs field (src/collections/Org.ts:17)
  • Comment out defaultSort in the related collection (src/collections/Repo.ts:5)
Link to the code that reproduces this issue

https://github.com/nathanbowang/payload-localization-issues

Reproduction Steps

Run the test in the repo

Image
Which area(s) are affected?

area: core

Environment Info
$ npx payload info

Binaries:
  Node: 24.11.1
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.25.0
Relevant Packages:
  payload: 3.72.0
  next: 15.4.10
  @payloadcms/db-postgres: 3.72.0
  @payloadcms/drizzle: 3.72.0
  @payloadcms/graphql: 3.72.0
  @payloadcms/next/utilities: 3.72.0
  @payloadcms/richtext-lexical: 3.72.0
  @payloadcms/translations: 3.72.0
  @payloadcms/ui/shared: 3.72.0
  react: 19.2.1
  react-dom: 19.2.1
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Thu, 08 Jan 2026 10:03:06 +0000
  Available memory (MB): 31794
  Available CPU cores: 20
y

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reproduction test in the linked payload-localization-issues repository with localizeStatus, drafts, a draft join field, and a locale parameter enabled. Compare the configuration in src/collections/Org.ts:17 and src/collections/Repo.ts:5, including the tabs field name and defaultSort. Done means the test no longer produces PostgreSQL's invalid FROM-clause reference error.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
backend, databases, localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.