Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

In PostgreSQL you can create a column with data type character varying (without length precision) or text like this:

ALTER TABLE test ADD COLUMN c1 varchar;
ALTER TABLE test ADD COLUMN c2 text;

Is there a difference between these two data types?

The documentation is not clear about it. They say :

If character varying is used without length specifier, the type accepts strings of any size.

[...]

In addition, PostgreSQL provides the text type, which stores strings of any length.

It seems that these two datatypes are equivalent but it is not explicit... More info about this?

Thank you, Nico

share|improve this question
7  
See the answer at serverfault.com –  Daniel Vérité Jul 2 '12 at 12:47
add comment

1 Answer

up vote 2 down vote accepted

There is no difference between the two data types. They use the exact same storage and the same operators.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.