Skip to content

Commit 1baf225

Browse files
committed
Update README with supported versions, MySQL 9.x notes, and PostgreSQL details
- Add supported versions table covering MySQL, Percona, MariaDB, PostgreSQL - Document MySQL 9.5 --commands flag and 9.6 md5/sha removal - Explain SHA-256 as the recommended cross-database integrity test - Expand PostgreSQL section: differences from MySQL, data integrity guarantees, SHA-256 compatibility between MySQL and PostgreSQL
1 parent f7d7383 commit 1baf225

1 file changed

Lines changed: 56 additions & 9 deletions

File tree

README.md

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,34 @@ See usage in the [MySQL docs](https://dev.mysql.com/doc/employee/en/index.html)
1111
[![CI PostgreSQL](https://github.com/datacharmer/test_db/actions/workflows/ci-postgresql.yml/badge.svg)](https://github.com/datacharmer/test_db/actions/workflows/ci-postgresql.yml)
1212

1313

14+
## Supported Versions
15+
16+
This database is regularly tested against the following server versions:
17+
18+
| Vendor | Versions |
19+
|--------|----------|
20+
| MySQL | 8.0, 8.4, 9.0, 9.2, 9.5, 9.6 |
21+
| Percona Server | 8.0, 8.4 |
22+
| MariaDB | 10.11, 11.4, 12.1 |
23+
| PostgreSQL | 16, 17 |
24+
25+
All versions are tested weekly via CI using [ProxySQL/dbdeployer](https://github.com/ProxySQL/dbdeployer).
26+
27+
### MySQL 9.x Notes
28+
29+
Starting with MySQL 9.5, the `SOURCE` command requires the `--commands` flag on the client:
30+
31+
mysql --commands < employees.sql
32+
33+
Starting with MySQL 9.6, the `MD5()` and `SHA()` functions have been removed from the server.
34+
The integrity test files `test_employees_md5.sql` and `test_employees_sha.sql` will not work on 9.6+.
35+
Use `test_employees_sha2.sql` instead, which uses `SHA2(..., 256)` and is compatible with all versions:
36+
37+
mysql -t < test_employees_sha2.sql
38+
39+
The SHA-256 checksums are identical across all supported MySQL, Percona, MariaDB, and PostgreSQL versions.
40+
41+
1442
## Where it comes from
1543

1644
The original data was created by Fusheng Wang and Carlo Zaniolo at
@@ -59,11 +87,11 @@ If you want to install with two large partitioned tables, run
5987

6088
## Testing the installation
6189

62-
After installing, you can run one of the following
90+
After installing, you can run one of the following integrity tests:
6391

64-
mysql -t < test_employees_md5.sql
65-
# OR
66-
mysql -t < test_employees_sha.sql
92+
mysql -t < test_employees_sha2.sql # SHA-256 (works on all versions including 9.6+)
93+
mysql -t < test_employees_md5.sql # MD5 (MySQL 8.0–9.5 only)
94+
mysql -t < test_employees_sha.sql # SHA-1 (MySQL 8.0–9.5 only)
6795

6896
For example:
6997

@@ -107,7 +135,25 @@ For example:
107135

108136
## PostgreSQL Installation
109137

110-
The database is also available for PostgreSQL. The schema and data are identical.
138+
The database is also available for PostgreSQL 12+. The schema and data are identical
139+
to the MySQL version. All files are in the `postgresql/` directory.
140+
141+
### Differences from the MySQL version
142+
143+
- **ENUM type**: MySQL `ENUM('M','F')` is replaced with `CHAR(1) CHECK (gender IN ('M','F'))`
144+
- **Stored procedures**: MySQL's `delimiter //` syntax is replaced with PostgreSQL dollar-quoting (`$...$ LANGUAGE plpgsql`)
145+
- **`show_departments()`**: Implemented as a function returning TABLE (use `SELECT * FROM show_departments();` instead of `CALL show_departments();`)
146+
- **User variables**: MySQL's `@var := value` pattern is replaced with PL/pgSQL local variables
147+
- **Integrity tests**: Use the same incremental hashing approach but via PL/pgSQL helper functions instead of MySQL user variables
148+
149+
### Data integrity across databases
150+
151+
The SHA-256 checksums are **identical** between MySQL and PostgreSQL. This is verified in CI:
152+
the same expected values in `test_employees_sha2.sql` and `postgresql/test_employees_sha2.sql`
153+
produce matching results on both databases. The MySQL version uses `SHA2(..., 256)` while
154+
PostgreSQL uses `encode(digest(..., 'sha256'), 'hex')` from the `pgcrypto` extension.
155+
156+
### Installation
111157

112158
1. Download the repository
113159
2. Install PostgreSQL (12+)
@@ -122,15 +168,16 @@ The database is also available for PostgreSQL. The schema and data are identical
122168

123169
### Testing the PostgreSQL installation
124170

125-
psql -d employees < postgresql/test_employees_md5.sql
126-
# OR
127-
psql -d employees < postgresql/test_employees_sha.sql
171+
psql -d employees < postgresql/test_employees_sha2.sql # SHA-256 (recommended)
172+
psql -d employees < postgresql/test_employees_md5.sql # MD5
173+
psql -d employees < postgresql/test_employees_sha.sql # SHA-1 (requires pgcrypto)
128174

129175
### Optional: load stored procedures and functions
130176

131177
psql -d employees < postgresql/objects.sql
132178

133-
Available functions: `emp_name()`, `emp_dept_name()`, `emp_dept_id()`, `current_manager()`, `show_departments()` (use `SELECT * FROM show_departments();`), `employees_help()`.
179+
Available functions: `emp_name()`, `emp_dept_name()`, `emp_dept_id()`, `current_manager()`,
180+
`show_departments()` (use `SELECT * FROM show_departments();`), `employees_help()`.
134181

135182

136183
## DISCLAIMER

0 commit comments

Comments
 (0)