0

I tried inserting a record into a Postgres database, and got a "key already exists" error message, in Go:

S:"ERROR" M:"duplicate key value violates unique constraint \"unique_name\"" n:"unique_name" 
F:"nbtinsert.c" L:"398" C:"23505" D:"Key (name)=(kevinburke) already exists." 
s:"public" t:"players" R:"_bt_check_unique"

It's clear that each of these fields has a meaning for Postgres. I've tried searching for documentation but I can't find anything online; where can I find out what each of the fields means?

(For reference, the string I am looking at is generated by the "pq" Go driver wrapper: https://github.com/bmizerany/pq/blob/master/error.go#L32)

1

2 Answers 2

1

The list of identification tokens and their meanings can be found here:

Error and Notice Message Fields - Postgres

Sign up to request clarification or add additional context in comments.

Comments

1

Is it possible that you're trying to auto-generate the primary key and your sequences have an incorrect value? If this makes no sense, could you post the query actually sent to the DB?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.