From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | Reid Thompson <reid(dot)thompson(at)ateb(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Is this safe to perform on PostgreSQL 8.3.7 -> Resize a column in a PostgreSQL table without changing data |
Date: | 2011-11-22 15:21:48 |
Message-ID: | CAOR=d=3uQta00FfWwxRUy2ek3rrm30e9SQMJ0KXrAiCP=ShZ8w@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Nov 22, 2011 at 7:50 AM, Reid Thompson <reid(dot)thompson(at)ateb(dot)com> wrote:
> Note that I manually added the 4 to the desired size of 35..again, for
> some legacy reasons inside PG. Done. That's it. Should we check?
>
> d TABLE1
>
> TABLE "public.TABLE1"
> COLUMN | TYPE | Modifiers
> --------+-----------------------+-----------
> COL1 | CHARACTER VARYING(35) |
>
> Such a simple yet effective trick. Of course it'd be nicer if this is
> somehow included in a more proper way in the database, but this does the
> job.
Note that this method works around all the safe guards etc that make
sure your data is safe and coherent. It works, as long as you're
careful what you're doing.
the real solution, to me, is to stop using varchar limits unless
there's a real reason for them. I.e. arbitrary limits on things like
name lengths make no sense in the db.
From | Date | Subject | |
---|---|---|---|
Next Message | sunpeng | 2011-11-22 15:47:15 | are there any methods to disable updating index before inserting large number tuples? |
Previous Message | Reid Thompson | 2011-11-22 14:50:05 | Is this safe to perform on PostgreSQL 8.3.7 -> Resize a column in a PostgreSQL table without changing data |