Ram
Ram

Reputation: 369

Why char datatype is converted to bpchar automatically?

Is there any possible to convert CHAR datatype into bpchar automatically?

We have seen the scenario which selected column datatype is CHAR from application end but database level bpchar got created.

Can anyone help me on this?

Upvotes: 15

Views: 39198

Answers (1)

Vao Tsun
Vao Tsun

Reputation: 51466

https://www.postgresql.org/docs/current/static/datatype-character.html

character(n), char(n) fixed-length, blank padded

Effectively in bpchar b stands for blank and p stands for padded and bpchar is same as char(n) or character(n), a blank padded to n length string...

More quotes:

https://www.postgresql.org/docs/current/static/typeconv-query.html

bpchar (“blank-padded char”, the internal name of the character data type)

Upvotes: 25

Related Questions