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

Migration script 11.0.0-12.0.0.sql fails when upgrading #14142

Closed
GMellar opened this issue Jun 28, 2020 · 4 comments
Closed

Migration script 11.0.0-12.0.0.sql fails when upgrading #14142

GMellar opened this issue Jun 28, 2020 · 4 comments
Labels
Bug This is a bug (something does not work as expected)

Comments

@GMellar
Copy link

GMellar commented Jun 28, 2020

I'm using postgresql 9.6.17. The following error came up:

DB_ERROR_SYNTAX: DROP INDEX ix_fk_product_stockALTER TABLE llx_actioncomm DROP COLUMN punctual;
ERROR: 42601: syntax error at or near "TABLE" LINE 1: DROP INDEX ix_fk_product_stockALTER TABLE llx_actioncomm DRO... ^ LOCATION: scanner_yyerror, scan.l:1127

DB_ERROR_42804: ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0;
ERROR: 42804: column "printable" cannot be cast automatically to type integer HINT: You might need to specify "USING printable::integer". LOCATION: ATPrepAlterColumnType, tablecmds.c:8056

@GMellar GMellar added the Bug This is a bug (something does not work as expected) label Jun 28, 2020
@eldy eldy closed this as completed in 2de1433 Jun 28, 2020
@GMellar
Copy link
Author

GMellar commented Jun 29, 2020

Thanks for the quick fix. I tried it but there seems to be one error left:

DB_ERROR_42804: ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0;
ERROR: 42804: column "printable" cannot be cast automatically to type integer HINT: You might need to specify "USING printable::integer". LOCATION: ATPrepAlterColumnType, tablecmds.c:8056

Somehow postgresql does not like that when modifying a column.

@atm-maxime atm-maxime reopened this Jun 29, 2020
@smonff
Copy link

smonff commented Jul 3, 2020

I also had problems during the migration with PostgreSQL for casting from BOOLEAN to INTEGER. I updated the script with:

ALTER TABLE llx_extrafields ADD COLUMN printable_int integer DEFAULT 0;
ALTER TABLE llx_extrafields DROP COLUMN printable;
ALTER TABLE llx_extrafields RENAME COLUMN printable_int TO printable;

It should work if you have no data in this table. Otherwise something like this should be considered.

@GMellar
Copy link
Author

GMellar commented Jul 4, 2020 via email

@dpriskorn
Copy link
Contributor

This was fixed in 48adeb9. Please close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

4 participants