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

Unable to migrate OctoberCMS on Postgres database #234

Closed
envas opened this issue Jul 10, 2021 · 4 comments
Closed

Unable to migrate OctoberCMS on Postgres database #234

envas opened this issue Jul 10, 2021 · 4 comments
Labels
duplicate Issues that are a duplicate of another reported issue

Comments

@envas
Copy link

envas commented Jul 10, 2021

  • Winter CMS Build: 1.1.3 (currently latest)
  • PHP Version: 7.3.18
  • Database Engine: PostgreSQL server version 11.6

Description:

I performed the migration from OctoberCMS build 472 using composer update. On the development system with MySQL everything was ok. On the stage system with Posgres database the upgrade process was ok (no errors), however, I cannot open any page. The exception I get is

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: character varying = integer LINE 1: ...ystem_files" where "system_files"."attachment_id" in (1, 2) ... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. (SQL: select * from "system_files" where "system_files"."attachment_id" in (1, 2) and "system_files"."attachment_type" = RainLab\Blog\Models\Post and "field" = featured_images order by "sort_order" asc)

Looking at the table the reason is: on the database the attribute system_files.attachment_id is of type varchar and this type cannot be directly compared to integer:

select * from "system_files" 
 where "system_files"."attachment_id" in (1, 2) 
       and "system_files"."attachment_type" = "RainLab\Blog\Models\Post" 
       and "field" = featured_images 
order by "sort_order" asc

returns on the plain Postgres database

ERROR:  operator does not exist: character varying = integer
LINE 2:  where "system_files"."attachment_id" in (1, 2)

Probably Winter issue because with October everything worked fine.

@envas envas added needs review Issues/PRs that require a review from a maintainer Type: Unconfirmed Bug labels Jul 10, 2021
@envas
Copy link
Author

envas commented Jul 10, 2021

A note to the error - it occurs whenever blog entries are listed. So it looks like a bug related to the RainLab.Blog plugin. Anyway, it occurs while accessing the system_files table, which belongs IMO to the Winter core.

@envas
Copy link
Author

envas commented Jul 10, 2021

Looks like a duplicate of wn-blog-plugin issue

@RomainMazB
Copy link
Contributor

RomainMazB commented Jul 15, 2021

Hi @envas,
Yes, I can confirm this issue is a duplicate of wintercms/wn-blog-plugin#16 .
As said in the other thread, I fixed it in the past but somebody mentioned a side effects.

You can confirm this issue is related by disabling the eager loading of featured images into the Posts component. This will be properly fixed soon.

This line is causing the trouble: https://github.com/wintercms/wn-blog-plugin/blob/1eb285add38159365c522d7124c3719fe553c926/components/Posts.php#L205

@bennothommo bennothommo removed needs review Issues/PRs that require a review from a maintainer Type: Unconfirmed Bug labels Jul 20, 2021
@bennothommo
Copy link
Member

Duplicate of wintercms/wn-blog-plugin#16.

Will be fixed by #216 when it's merged.

@bennothommo bennothommo linked a pull request Jul 20, 2021 that will close this issue
@bennothommo bennothommo added the duplicate Issues that are a duplicate of another reported issue label Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues that are a duplicate of another reported issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants