When use golang connect to postgres, if you want to call LastInsertId, you will get this error. But you can get the latest ID by another method. Use Returning keyword to get the newest inserted ID. Just like below:

var id int
if err := db.QueryRow("INSERT INTO table(name) VALUES("xxxx") RETURNING ID").Scan(&id); err != nil {