On Thu, Mar 5, 2009 at 3:27 PM, Xuân Baldauf <xuan--2009.03--submitbug--support--postgresql....@baldauf.org> wrote: > > > Well, while this behaviour is well-known for PostgreSQL, this is actually an > abuse of syntax. If there are legitimate requirements for rewriting a table, > then there should be explicit syntax for such a feature, like "ALTER TABLE > ... REWRITE". Rewriting a table in case of "ALTER TABLE ... TYPE" is, by the > semantics of that statement, just a side-effect, which may or may not > happen, depending on how optimized the DBMS is. It is bad design to avoid > optimization just because an unnecessary side-effect would be optimized > away. >
note that this is my opinion and not represent the PGDG (Postgresql Global Development Group) opinion > now, back to the problem... is not easier to define a column as TEXT > and to put a check to constraint the length? if you wanna change the > constraint that will be almost free > > No. Is it possible to change the column type from VARCHAR(5) to TEXT without > a table-rewrite penalty? > > the idea is to make that change once (and to create new tables just with TEXT) and then you can make ALTER TABLE ... ADD CHECK (length(column) = a_value) as many times as you want without the need for a table rewrite -- Atentamente, Jaime Casanova Soporte y capacitación de PostgreSQL Asesoría y desarrollo de sistemas Guayaquil - Ecuador Cel. +59387171157 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs