Mario Weilguni wrote:


   contacto varchar(255),
   fuente varchar(512),
   prefijopais varchar(10)

Instead, use:

   contacto text,
   fuente text,
   prefijopais text

See the PostgreSQL manual for an explanation of varchar vs. text.

Enforcing length constraints with varchar(xyz) is good database design, not a bad one. Using text everywhere might be tempting because it works, but it's not a good idea.


I've always used the rationale:

If you *know* that the data is length constrained, then it is ok to reflect this in the domain you use - err, thats why they have length limits! e.g. if you know that 'prefijopais' can *never* be > 10 chars in length, then varchar(10) is a good choice.

If the data length is unknown or known to be unlimited, then reflect that in the domain you use - e.g if 'fuente' or 'contacto' have no reason to be constrained, then just use text.

best wishes

Mark


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to