What is the correct column type for holding ZipCode values in PostgreSQL database?
What is the correct column type for holding ZipCode values in PostgreSQL database?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is something like xxxxx-xxxx, so
varchar(10)is recommended.If you want to check the syntax of the values in the database, you could create a
domaintype for zip codes.You could have a look at this site, which proposes this regex:
But you should check it works for the
PostgreSQLregex syntax.