Oct 25, 2008

PostgreSQL の varchar, char は文字数か? バイト数か?

という論争が起きたので(笑)、公式のドキュメントで裏を取ってみた。

PostgreSQL : Documentation : Manuals : PostgreSQL 8.2 : Character Types
http://www.postgresql.org/docs/8.2/interactive/datatype-character.html
SQL defines two primary character types: character varying(n) and character(n), where n is a positive integer. Both of these types can store strings up to n characters in length.
ということで、varchar も char も文字数ということの様だ。 ・・・「バイト数でした」ということになっていたら大変なことになるところだった(^^;

TrackBack ping me at
http://www.in-vitro.jp/blog/index.cgi/PostgreSQL/20081025_01.trackback
Post a comment

writeback message: Ready to post a comment.