Storing an ISBN-13 as string or integer (PostgreSQL)

I think the answer partly depends on whether you care about the sub parts of of the ISBN-13, for example searching on books in a certain country or publisher. it also depends on whether you need to support ISBN-10 which allows for the character X as the check digit.

If you store as a string then I would suggest you remove any non-digits to formatting separate from validation.

There is a GTIN validation lib you might find useful too since an ISBN-13 is a subset of a GTIN.