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

INSERT's are failing for long table names #115

Closed
ahilmer opened this issue Sep 11, 2023 · 2 comments
Closed

INSERT's are failing for long table names #115

ahilmer opened this issue Sep 11, 2023 · 2 comments

Comments

@ahilmer
Copy link
Contributor

ahilmer commented Sep 11, 2023

Hi pg-osc team,

we successfully used your tool to rebuild a bloated table on production without any downtime! It shrank from around 400GB down to 100GB.

During the testing phase we had to apply some custom adoptions to the source code which we would like to contribute back 😃

This one handles a bug where an INSERT into the primary table fails during the execution on a large table name ( e.g. this_is_a_table_with_a_very_long_name).

Steps to reproduce

  1. Minimal test setup
drop table if exists "this_is_a_table_with_a_very_long_name";

 CREATE TABLE IF NOT EXISTS "this_is_a_table_with_a_very_long_name" (
id int PRIMARY KEY,
"createdOn" TIMESTAMP NOT NULL
);
      
insert into "this_is_a_table_with_a_very_long_name"("id", "createdOn") values(1, '2012-01-01')
  1. Add a breakpoint

Selection_885

  1. run pg-osc
bundle exec bin/pg-online-schema-change perform  --host localhost --dbname postgres --username celonis  --alter-statement 'alter table this_is_a_table_with_a_very_long_name alter column id TYPE int'
  1. Run an INSERT

Selection_884

==> Result: The INSERT into the primary table fails

Suggested Solution

Read the real sequence name using SELECT pg_get_serial_sequence(:table, :column)

@ahilmer
Copy link
Contributor Author

ahilmer commented Sep 11, 2023

I forked the repository and adding here the PR #116

Happy to hear back from you 😃

@shayonj
Copy link
Owner

shayonj commented Sep 15, 2023

Closed via #116

@shayonj shayonj closed this as completed Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants