BUG #16672: Postgres user passwords are corrupted during migration

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: zz5s-akd(at)asahi-net(dot)or(dot)jp
Subject: BUG #16672: Postgres user passwords are corrupted during migration
Date: 2020-10-14 23:05:47
Message-ID: 16672-cdf02792fc851417@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16672
Logged by: shigeki akada
Email address: zz5s-akd(at)asahi-net(dot)or(dot)jp
PostgreSQL version: 13.0
Operating system: Windows 10 64bit 10.0.18363 Build 18363
Description:

Hi maintainers
my name Shigeki Akada. from Japan
The postgres user password is corrupted when migrating from Postgresql 12.4
to Postgresql 13.
It happens with dumps and restores, and also with pg_migration.
Below is the log of dump and restore execution. Please forgive that some
Japanese is included.
----- log -----
01.environment
OS Windows 10 64bit 10.0.18363 Build 18363
CPU AMD Ryzen Threadripper 1950X 16C/32T
Memory 128GB DDR4
Postgresql 12 Install Directrory C:\Program Files\PostgreSQL\12
Postgresql 13 Install Directrory C:\Program Files\PostgreSQL\13
Postgresql 12 Data Directory E:\Postgresql12Database
Postgresql 13 Data Directory E:\Postgresql13Database
C Drive Usage 169GB/832GB 20% used
E Drive Usage 67GB/1.81TB 3.7% used

Postgresql 12 Config
Port:5432
use password file

cmd.exe Start Administrator mode

02.Postgresql 12 Stop
C:\>net stop postgresql-x64-12
postgresql-x64-12 - PostgreSQL Server 12 サービスを停止中です.
postgresql-x64-12 - PostgreSQL Server 12 サービスは正常に停止されました。
--> Normal stop

03.Postgresql 12 Physical backup
C:\>xcopy E:\Postgresql12Database E:\Postgresql12Database.copy\ /s/e
--> Normal end

04.Postgresql 13 Install
Installer postgresql-13.0-1-windows-x64.exe
Install Directory C:\Program Files\PostgreSQL\13
Data Directory E:\Postgresql13Database
User postgres Password:postgres Same as version 12
Port 5432 Same as version 12
Locale C Same as version 12
--> no error install and running

05.Postgresql 13 Stop
C:\>net stop postgresql-x64-13
postgresql-x64-13 サービスを停止中です.
postgresql-x64-13 サービスは正常に停止されました。
--> Normal stop

05.Postgresql 13 Physical backup
C:\>xcopy E:\Postgresql13Database E:\Postgresql13Database.copy\ /s/e
--> Normal end

06.Migration [Method:Dump and Restore]
a.Postgresql 12 Start
C:\>net start postgresql-x64-12
postgresql-x64-12 - PostgreSQL Server 12 サービスを開始します.
postgresql-x64-12 - PostgreSQL Server 12 サービスは正常に開始されました。
--> Normal Start

b.Login Check Use Postgresql 12 SQL.Shell
Use psql
Server [localhost]:
Database [postgres]:
Port [4321]:
Username [postgres]:
Client Encoding [SJIS]:
psql (12.4)
"help"でヘルプを表示します。
postgres=#
--> Login OK

c.Backup
C:\>"c:\Program Files\PostgreSQL\13\bin\pg_dumpall.exe" -U postgres >
w:\postgresql12.dump
--> Normal end
C:\dir w:
ドライブ W のボリューム ラベルは Backup です
ボリューム シリアル番号は BAD2-D2F3 です
W:\ のディレクトリ
2020/10/15 07:14 26,024,577,750 postgresql12.dump
2020/10/14 07:54 <DIR> SystemBackup
1 個のファイル 26,024,577,750 バイト
1 個のディレクトリ 2,475,273,895,936 バイトの空き領域

d.Postgresql 12 Stop
C:\>net stop postgresql-x64-12
postgresql-x64-12 - PostgreSQL Server 12 サービスを停止中です.
postgresql-x64-12 - PostgreSQL Server 12 サービスは正常に停止されました。
--> Normal stop

e.Postgresql 13 Start
C:\>net start postgresql-x64-13
postgresql-x64-13 サービスを開始します.
postgresql-x64-13 サービスは正常に開始されました。
--> Normal Start

f.Login Check Use Postgresql 13 SQL.Shell
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Client Encoding [SJIS]:
psql (13.0)
"help"でヘルプを表示します。
postgres=#
--> Login OK

g.Restore
C:\>"c:\Program Files\PostgreSQL\13\bin\psql.exe" -U postgres -d postgres
-f w:\postgresql12.dump
psql: エラー: サーバに接続できませんでした: FATAL: password authentication failed for user
"postgres"
ファイル"C:\Users\<UserName>\AppData\Roaming/postgresql/pgpass.conf"からパスワードを読み込みました

h.Login Check Use Postgresql 13 SQL.Shell
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Client Encoding [SJIS]:
psql: エラー: サーバに接続できませんでした: FATAL: password authentication failed for user
"postgres"
ファイル"C:\Users\<UserName>\AppData\Roaming/postgresql/pgpass.conf"からパスワードを読み込みました

i.Password File Rename
C:\>rename C:\Users\<UserName>\AppData\Roaming\postgresql\pgpass.conf
pgpass.conf.bak
C:\>dir C:\Users\<UserName>\AppData\Roaming\postgresql
ドライブ C のボリューム ラベルは Win10Pro_64Bit です
ボリューム シリアル番号は 3E38-A371 です
C:\Users\<UserName>\AppData\Roaming\postgresql のディレクトリ
2020/10/15 07:35 <DIR> .
2020/10/15 07:35 <DIR> ..
2020/10/12 20:59 212 pgpass.conf.bak
1 個のファイル 212 バイト
2 個のディレクトリ 716,801,114,112 バイトの空き領域

j.Postgresql 13 Stop
C:\>net stop postgresql-x64-13
postgresql-x64-13 サービスを停止中です.
postgresql-x64-13 サービスは正常に停止されました。
--> Normal stop

k.Postgresql 13 Data Directory Remove
C:\>rmdir E:\Postgresql13Database /S/Q

l.Postgresql 13 Data Directory Restore
C:\>xcopy E:\Postgresql13Database.copy E:\Postgresql13Database\ /s/e

m.Postgresql 13 Start
C:\>net start postgresql-x64-13
postgresql-x64-13 サービスを開始します.
postgresql-x64-13 サービスは正常に開始されました。
--> Normal Start

n.Login Check Use Postgresql 13 SQL.Shell
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Client Encoding [SJIS]:
ユーザ postgres のパスワード: <-- input postgres
psql (13.0)
"help"でヘルプを表示します。
postgres=#

o.Restore Retry
C:\>"c:\Program Files\PostgreSQL\13\bin\psql.exe" -U postgres -d postgres
-f w:\postgresql12.dump
C:\>"c:\Program Files\PostgreSQL\13\bin\psql.exe" -U postgres -d postgres
-f w:\postgresql12.dump
ユーザ postgres のパスワード: <-- input postgres
SET
SET
SET
CREATE ROLE
ALTER ROLE
COMMENT
psql:w:/postgresql12.dump:17: ERROR: role "postgres" already exists
ALTER ROLE
psql:w:/postgresql12.dump:33: エラー: \connect: FATAL: password
authentication failed for user "postgres"

p.Login Check Use Postgresql 13 SQL.Shell
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Client Encoding [SJIS]:
ユーザ postgres のパスワード:
psql: エラー: サーバに接続できませんでした: FATAL: password authentication failed for user
"postgres"

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-10-15 00:09:48 Re: BUG #16672: Postgres user passwords are corrupted during migration
Previous Message Tom Lane 2020-10-14 22:45:53 Re: BUG #16671: "generated always as" is ignored when updating table through view