Andrew K Odeki
Andrew K Odeki

Reputation: 1

Monetdb Conversion of string to blob failed

I have a Golang User struct with PasswordHash of type *[]byte

type User struct {
    ID           UserID     `json:"id,omitempty" db:"u_user_id"`
    PasswordHash *[]byte    `json:"-" db:"u_password_hash"`
    CreatedAt    *time.Time `json:"-" db:"u_created_at"`
    
}

When i try to insert data as shown below

user := &User{
        ID:        id,
        PasswordHash: &hashedPassword,
    }

var result *model.User
    rows, err := db.NamedQuery(createUserQuery, user)
    if err != nil {
        panic(err)
    }

i get an Operational error:

panic: Operational error: 42000!Conversion of string '$2a$10$sODoBKGZtXzQziSDzFGJKuxZ0cSiNN38ZqD4YtmoLsWOa7K0bVXWW' to blob failed

is it that i have a wrong database type because my MonetDb type for the password column is blob

Upvotes: 0

Views: 108

Answers (1)

MitchellWeg
MitchellWeg

Reputation: 49

Can you open a bug report at https://github.com/MonetDB/MonetDB-Go with a specific reproducible example? I was not able to reproduce the problem.

Upvotes: 0

Related Questions