ALTER PRIMARY KEY migration code does not work in Postgres 9.2

Description

Running 5.24 on a postgres 9.2 server gives

This is because LATERAL keyword is only available from 9.3 onwards.

QA Test Steps

  • Have a pre-existing mattermost instance on 5.23 with postgres 9.2.

  • Start the server built with this PR.

  • Verify that the primary key for Reactions table has the columns in order of - Postid, UserId, Emojiname. Before that, it should have been Userid, PostId, Emojiname

  • Start the server again and verify that it remains the same.

Repeat the experiment with postgres 9.6, and confirm that the 2 steps (starting, and then restarting) lead to the same result.

Activity

Show:
Rohitesh Gupta
June 26, 2020, 6:18 PM

Tested it on the latest 5.24 mattermost-server branch on Postgres 9.2 and Postgres 9.6 and here is the summary of my testing. Note: This needed to be tested on localhost since it required different Postgres versions and upgrades from 5.23 to 5.24.

Postgres 9.2:

  • On Postgres 9.2, upgraded from 5.22 to 5.23 and restarted server and PK remains intact.

  • On Postgres 9.2, upgraded from 5.23 to 5.24 and restarted server and PK remains intact. However server did not start and threw the error mentioned in this ticket.

  • On Postgres 9.2 -> master applied the PR and restarted the server. PK remains intact. Server started successfully without any issues.

Postgres 9.6

  • On Postgres 9.6, upgraded from 5.22 to 5.23 and restarted server and PK remains intact.

  • On Postgres 9.6, upgraded from 5.23 to 5.24 and restarted server and PK remains intact. Server started successfully without the new PR.

  • On Postgres 9.6 -> master applied the PR and restarted the server. PK remains intact. Server started successfully without any issues.

Rohitesh Gupta
July 8, 2020, 1:09 PM

Tested it by on the localhost and the issue is fixed now on 5.25 and is working fine. Closing the ticket.

Done

Mana

None

Assignee

Agniva De Sarker

QA Assignee

Rohitesh Gupta

Reporter

Agniva De Sarker

Epic Link

None

Fix versions

Mattermost Team

Platform

Sprint

None

QA Testing Areas

Other (write in QA test steps)

GitHub Issue

None

Components

None

Severity

S1_data_loss_or_crash
Configure