Here are two posts that make a strong case for just using TEXT in Postgres while avoiding VARCHAR and CHAR. I agree. Wish I'd seen this long ago.
- PostgreSQL: Don't Use CHAR or VARCHAR by Jon Morton, with important comments by Josh Berkus.
- VARCHAR(n) Considered Harmful by David Fetter.
And for more info, experimentation, and discussion, see the post CHAR(X) VS. VARCHAR(X) VS. VARCHAR VS. TEXT by depesz.
The upshot is:
- Use the TEXT type for all your textual needs.
- If constraining the maximum, minimum, and content is important then define a CONSTRAINT. (No need to depend on the max length feature of varchar.)
Here is the posts that make a strong case for just using TEXT in Postgres while avoiding VARCHAR and CHAR. Download Free Crack Software Full Version
ReplyDelete