Is char(1) really use one byte space in postgresql?
-
Hello guys: I am a newbie to PostgreSQL database. I meet a problem when using PostgreSQL database. In the document http://www.postgresql.org/docs/9.1/interactive/datatype-character.html It's said that "char" use single-byte. Here is my test: CREATE TABLE test (text char(1)); and then I use: insert into test (test) values ('â¶'); (ⶠis a special char who's utf8 decode is 9654 (base 10).) It carried out perfect. And I use: SELECT * from test; test ------ ⶠ(1 row) How can single-byte store ⶠ? (PostgreSQL 9.1.9 on x86-64 Debian 7 OS)
-
Answer:
From the link you posted (emphasis mine) 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 (not bytes) in length. ... The notations varchar(n) and char(n) are aliases for character varying(n) and character(n), respectively. character without length specifier is equivalent to character(1).
Bo Shi at Quora Visit the source
Related Q & A:
- If you were to start using a Wordpress framework today, which one would you use?Best solution by WordPress
- Is it better to use many records in one table, or to use multiple tables?Best solution by Stack Overflow
- What exactly is an RSS feed and how/why would you use one?Best solution by Super User
- Looking for a place to stay for about 1 month that is really cheap?Best solution by Yahoo! Answers
- How to really use yahoo sms mobile?Best solution by mobile.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.