Last active
August 12, 2022 19:57
-
-
Save BacLuc/0ffb97c8d32b1190b649a955134d0625 to your computer and use it in GitHub Desktop.
Show which dbms support unique index on text columns with variable length
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE test ( | |
test text UNIQUE, | |
combined_key_part1 text, | |
combined_key_part2 text, | |
CONSTRAINT combined_key_unique UNIQUE (combined_key_part1, combined_key_part2) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
mariadb: | |
image: mariadb:10.5 | |
environment: | |
- MYSQL_DATABASE=db | |
- MYSQL_ROOT_PASSWORD=password | |
volumes: | |
- ./create-table-with-index.sql:/docker-entrypoint-initdb.d/create-table-with-index.sql | |
ports: | |
- "3306:3306" | |
mysql: | |
image: mysql:8.0.23 | |
environment: | |
- MYSQL_DATABASE=db | |
- MYSQL_ROOT_PASSWORD=password | |
volumes: | |
- ./create-table-with-index.sql:/docker-entrypoint-initdb.d/create-table-with-index.sql | |
ports: | |
- "3307:3306" | |
postgres: | |
image: library/postgres:13.2 | |
environment: | |
- POSTGRES_USER=postgres | |
- POSTGRES_PASSWORD=postgres | |
- POSTGRES_DB=test | |
volumes: | |
- ./create-table-with-index.sql:/docker-entrypoint-initdb.d/create-table-with-index.sql | |
ports: | |
- "5432:5432" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mariadb and postgres allow unique index on text columns, mysql does not