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

Relation <> does not exists #20509

Open
morohon opened this issue Jun 13, 2024 · 5 comments · May be fixed by #20531
Open

Relation <> does not exists #20509

morohon opened this issue Jun 13, 2024 · 5 comments · May be fixed by #20531

Comments

@morohon
Copy link

morohon commented Jun 13, 2024

Bug report

Required System information

  • Node.js version: 20.11.1
  • NPM version: 10.2.4
  • Strapi version: 4.25.0
  • Database: postgres
  • Operating system: macos m1 chip (app in docker node:20.11.1-alpine3.19)
  • Is your project Javascript or Typescript: Typescript

Describe the bug

Hi all.
When I try to click the duplicate entry button in colletion types, I get an Internal Server Error error on the UI admin panel.
In this case, the following error is displayed in the log:

strapi-1  | [2024-06-13 13:52:28.056] error: update "products_by_region_ep_product_links" as "t1" set "product_by_region_order" = (select max(product_by_region_order) + 1 from "products_by_region_ep_product_links" as "t2" where t2.ep_product_id = t1.ep_product_id) where "t1"."product_by_region_id" = $1 - relation "products_by_region_ep_product_links" does not exist
strapi-1  | error: update "products_by_region_ep_product_links" as "t1" set "product_by_region_order" = (select max(product_by_region_order) + 1 from "products_by_region_ep_product_links" as "t2" where t2.ep_product_id = t1.ep_product_id) where "t1"."product_by_region_id" = $1 - relation "products_by_region_ep_product_links" does not exist

I looked in the database and there is a created table products_by_region_ep_product_links. I also found a ticket that talks about a similar problem: #17672. I did what was recommended there (cleared the strapi_database_schema table) and it didn't help.
Looking at the error, you can understand that he has some problems with relation to another collection type.

Steps to reproduce the behavior

  1. Go to 'Content manager'
  2. Click on 'Open collection type'
  3. Select a line and click the duplicate button

Expected behavior

The recording was successfully duplicated

Screenshots

image

Code snippets

If applicable, add code samples to help explain your problem.

Additional context

Add any other context about the problem here.

@morohon
Copy link
Author

morohon commented Jun 13, 2024

Found that if you change the schema in postgresql to public, then creating a duplicate works.
It seems that somewhere in the request for a double they forgot to specify the schema for executing the request and it expects a table in the default public schema

@morohon
Copy link
Author

morohon commented Jun 16, 2024

image
This is what the request structure looks like. It can be seen that when executing one request, there is no indication of the scheme

@morohon
Copy link
Author

morohon commented Jun 16, 2024

If I researched correctly, then apparently the problematic code is located here, it was added as part of this #16192.
It's as if this code is missing an extra method call addSchema, like this is done here or here

@morohon
Copy link
Author

morohon commented Jun 16, 2024

@Marc-Roig I apologize for tagging you, but maybe you will have the opportunity to watch my investigation?

morohon pushed a commit to morohon/strapi that referenced this issue Jun 16, 2024
@morohon morohon linked a pull request Jun 16, 2024 that will close this issue
morohon pushed a commit to morohon/strapi that referenced this issue Jun 16, 2024
morohon added a commit to morohon/strapi that referenced this issue Jun 16, 2024
@MikolJ
Copy link

MikolJ commented Jun 24, 2024

We have the same issue.
Any info on when this fix will be included in an upcoming patch/minor version? It's still in PR, but it seems like a quite straightforward to check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To review
Development

Successfully merging a pull request may close this issue.

2 participants