PostgreSQL: Alter table field CHAR length

So the annoying thing about character fields is that they have a limit.

When you try to save the row and the data is too long, it'll fail.

So to increase the limit, run this query:

ALTER TABLE tablename
ALTER COLUMN url TYPE varchar(500),
ALTER COLUMN description TYPE varchar(300);

That's it! The fields url/description will now have the lengths of 500/300 respectively and maintain the original data.

BOOM! Headshot!


Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog