Migration 20211005093558_add_range_partitioned_loose_fk_table.rb fails in EDB Postgres due to reserved keyword "partition"

Release notes

Fixes failed migration with EDB Postgres due to use of a reserved keyword "partition" in SQL:2011 and SQL:2016 standards, that's allowed in standard Postgres.

Problem to solve

This affects customers using EDB Postgres advanced server as an external database.

While attempting to upgrade from 14.2.6 to 14.6.5 the migration 20211005093558_add_range_partitioned_loose_fk_table.rb fails due to a syntax error:

PG::SyntaxError: ERROR:  syntax error at or near "partition"
LINE 3:   partition bigint NOT NULL,

The reason that this is occurring is that partition is a reserved word in EDB Postgres and cannot be used to name a column. This complies with SQL:2011 and SQL:2016 standards but "partition" is non-reserved in PostgreSQL as shown under the SQL keywords appendix.

Proposal

This will require some discussion as it would require a non-trivial, multi-milestone migration to fix in GL (rename partition column). We're not even sure that we can backport this safely. If we go with the column rename, we might need to give special instructions for affected customers to skip the non-compliant migrations.

Customer issue: https://gitlab.zendesk.com/agent/tickets/273596 (Internal use only)

As discussed internally with @iroussos @ahegyi

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖