Skip to content

Rename tables and columns with names that are too long for PostgreSQL#7458

Open
labkey-adam wants to merge 7 commits intodevelopfrom
fb_long_names_to_short
Open

Rename tables and columns with names that are too long for PostgreSQL#7458
labkey-adam wants to merge 7 commits intodevelopfrom
fb_long_names_to_short

Conversation

@labkey-adam
Copy link
Contributor

@labkey-adam labkey-adam commented Feb 25, 2026

Rationale

Microsoft SQL Server allows table and column names that are longer than what PostgreSQL allows (128 characters vs. 63 UTF-8 bytes). Long names on SQL Server can foul up the SQL Server to PostgreSQL migration process. We address this by renaming all existing SQL Server long table/column names and updating SQL Server to produce PostgreSQL-compatible names going forward.

https://github.com/LabKey/internal-issues/issues/869

@labkey-adam labkey-adam marked this pull request as draft February 25, 2026 22:35
@labkey-adam labkey-adam marked this pull request as ready for review February 27, 2026 23:00
LOG.info(" Table \"{}\" renamed to \"{}\" ({} bytes)", oldName, newName, newName.getBytes(StandardCharsets.UTF_8).length);
});

List<String> badTableNames = new TableSelector(tinfoDomainDescriptor, new CsvSet("StorageTableName"), filter, null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems odd. If it's needed, would it be better to capture them in the forEach? I don't think we're getting value out of setting it in the DB and then querying the DB for them.

Copy link
Contributor Author

@labkey-adam labkey-adam Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it to verify that the renaming steps worked as expected. There are a lot of moving parts... especially with the multi-step column-renaming process. The table-renaming steps used to be more complex; I simplified them, but it seemed reasonable to leave the check in.

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

Successfully merging this pull request may close these issues.

2 participants