"David Johnston" <polobo@xxxxxxxxx> wrote: > If you want to guarantee that the INSERT will work you would need > to write: > > INSERT INTO test_table VALUES ( $1::char(10), $2::varchar(20) ) Note that this will quietly cut off the tail end of the supplied data, so it should only be used when that is desirable. It is generally better to throw an error than to lose data. > whether "char" and "varchar" differ in their behavior in this > respect I do not know. Per the SQL standard, they both throw an error on attempts to assign an oversized value, but allow truncation through explicit casts. > It is generally not recommended to use "char" Right. It is supported because the standard specifies it and its behavior, but the semantics of char(n) are weird and the performance, in PostgreSQL, is generally worse for char(n) than varchar(n) or text. -Kevin -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general