diff --git a/internal/component/postgresql/postgresdbaccess.go b/internal/component/postgresql/postgresdbaccess.go index a6b0baccb..ac523cab6 100644 --- a/internal/component/postgresql/postgresdbaccess.go +++ b/internal/component/postgresql/postgresdbaccess.go @@ -167,10 +167,6 @@ func (p *PostgresDBAccess) doSet(parentCtx context.Context, db dbquerier, req *s return errors.New("missing key in set operation") } - if v, ok := req.Value.(string); ok && v == "" { - return errors.New("empty string is not allowed in set operation") - } - v := req.Value byteArray, isBinary := req.Value.([]uint8) if isBinary { diff --git a/state/mysql/mysql.go b/state/mysql/mysql.go index e26e16120..614754e3b 100644 --- a/state/mysql/mysql.go +++ b/state/mysql/mysql.go @@ -497,11 +497,6 @@ func (m *MySQL) setValue(parentCtx context.Context, querier querier, req *state. var v any isBinary := false switch x := req.Value.(type) { - case string: - if x == "" { - return errors.New("empty string is not allowed in set operation") - } - v = x case []uint8: isBinary = true v = base64.StdEncoding.EncodeToString(x) diff --git a/state/oracledatabase/oracledatabaseaccess.go b/state/oracledatabase/oracledatabaseaccess.go index 2564bc47e..0a42b33b3 100644 --- a/state/oracledatabase/oracledatabaseaccess.go +++ b/state/oracledatabase/oracledatabaseaccess.go @@ -126,9 +126,6 @@ func (o *oracleDatabaseAccess) doSet(ctx context.Context, db querier, req *state return errors.New("missing key in set operation") } - if v, ok := req.Value.(string); ok && v == "" { - return errors.New("empty string is not allowed in set operation") - } requestValue := req.Value byteArray, isBinary := req.Value.([]uint8) binaryYN := "N" diff --git a/state/sqlite/sqlite_dbaccess.go b/state/sqlite/sqlite_dbaccess.go index ed1f15bdf..a1dd3cc69 100644 --- a/state/sqlite/sqlite_dbaccess.go +++ b/state/sqlite/sqlite_dbaccess.go @@ -349,10 +349,6 @@ func (a *sqliteDBAccess) doSet(parentCtx context.Context, db querier, req *state return errors.New("missing key in set option") } - if v, ok := req.Value.(string); ok && v == "" { - return fmt.Errorf("empty string is not allowed in set operation") - } - // TTL var ttlSeconds int ttl, ttlerr := stateutils.ParseTTL(req.Metadata) diff --git a/tests/conformance/state/state.go b/tests/conformance/state/state.go index b9911bf0b..8a615855e 100644 --- a/tests/conformance/state/state.go +++ b/tests/conformance/state/state.go @@ -93,12 +93,16 @@ func ConformanceTests(t *testing.T, props map[string]string, statestore state.St }, { key: fmt.Sprintf("%s-string-with-json", key), - value: "{\"a\":\"b\"}", + value: `{"a":"b"}`, }, { key: fmt.Sprintf("%s-string", key), value: "hello world", }, + { + key: fmt.Sprintf("%s-empty-string", key), + value: "", + }, { key: fmt.Sprintf("%s-struct", key), value: ValueType{Message: fmt.Sprintf("test%s", key)}, @@ -216,7 +220,7 @@ func ConformanceTests(t *testing.T, props map[string]string, statestore state.St results: []state.QueryItem{ { Key: fmt.Sprintf("%s-struct", key), - Data: []byte(fmt.Sprintf("{\"message\":\"test%s\"}", key)), + Data: []byte(fmt.Sprintf(`{"message":"test%s"}`, key)), }, }, },