mirror of
https://github.com/pgsty/minio.git
synced 2026-07-22 13:40:22 +03:00
Validates PostgreSQL table name (#19602)
This commit is contained in:
@@ -36,3 +36,19 @@ func TestPostgreSQLRegistration(t *testing.T) {
|
||||
t.Fatal("postgres driver not registered")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPsqlTableNameValidation(t *testing.T) {
|
||||
validTables := []string{"táblë", "table", "TableName", "\"Table name\"", "\"✅✅\"", "table$one", "\"táblë\""}
|
||||
invalidTables := []string{"table name", "table \"name\"", "✅✅", "$table$"}
|
||||
|
||||
for _, name := range validTables {
|
||||
if err := validatePsqlTableName(name); err != nil {
|
||||
t.Errorf("Should be valid: %s - %s", name, err)
|
||||
}
|
||||
}
|
||||
for _, name := range invalidTables {
|
||||
if err := validatePsqlTableName(name); err != errInvalidPsqlTablename {
|
||||
t.Errorf("Should be invalid: %s - %s", name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user