When using the sqlx package in Go with a Postgres database, you may come across the following error: lastinsertid is not supported by this driver postgres This error will happen when you want to access the LastInsertId() of a newly inserted entity. In this post, I will show you how to fix this error without making any changes to your database. Let’s investigate a specific scenario where this error will occur: func CreateAppointment(appointment Appointment) int { result, err := database.Db.NamedExec("INSERT ...

Bernhard Knasmüller on Software Development