giozh
giozh

Reputation: 10068

postgres string type compatibility: varchar and character

On my postgresql database, i've declared all String field as

character(n)

Now i have some function that takes string argument as

varchar(n)

are this two datatype compatible or should i change type in function or in table declarement?

Upvotes: 1

Views: 856

Answers (1)

Ihor Romanchenko
Ihor Romanchenko

Reputation: 28541

Character types character(n) and varchar(n) are compatible and internally are the same type (but have different representation, when queried).

Details in this article

Upvotes: 1

Related Questions