You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like NamedQueryContext and NamedQuery are not returning errors when an insert fails when using a CTE. Small example as follows
query := `
WITH inserted AS (
INSERT INTO ticket (creator_id, account_id, team_id)
VALUES (:creator_id, :account_id, :team_id)
RETURNING id, created_at, team_id
)
SELECT inserted.id AS id, inserted.created_at AS created_at, team.name AS team_name
FROM inserted
LEFT JOIN team ON team.id = team_id
`
resp, err := s.db.NamedQueryContext(ctx, query, mapTicketCreate(t))
if err != nil {
return model.Ticket{}, err
}
var id string
var createdTime time.Time
var teamName string
if resp.Next() {
err := resp.Scan(&id, &createdTime, &teamName)
if err != nil {
return model.Ticket{}, err
}
}
No error is thrown in the code, but no records are inserted. Running the query directly in the DB does throw an error. createdTime and id are present in the response.
Using sqlx v1.3.5 with CockroachDB
The text was updated successfully, but these errors were encountered:
It seems like NamedQueryContext and NamedQuery are not returning errors when an insert fails when using a CTE. Small example as follows
No error is thrown in the code, but no records are inserted. Running the query directly in the DB does throw an error. createdTime and id are present in the response.
Using sqlx v1.3.5 with CockroachDB
The text was updated successfully, but these errors were encountered: