Re: Too short field
От | Thomas Kellerer |
---|---|
Тема | Re: Too short field |
Дата | |
Msg-id | b56469aa-4a9c-f678-a950-39fdcd43fb97@gmx.net обсуждение исходный текст |
Ответ на | Too short field (Karl Martin Skoldebrand <KS0C77263@TechMahindra.com>) |
Ответы |
RE: Too short field
Re: Too short field |
Список | pgsql-general |
Karl Martin Skoldebrand schrieb am 03.07.2019 um 13:30: > Now, we have a bug in another application that prevents an automatic > tool to enter certain users in the database. The organisational field > is varchar(60) while the actual Organisation “abbreviation” may be as > long as 70 characters (don’t ask why). > > What happens to data if I simple redefine the table field as > varchar(80) (or something, at least 70+). Does “everything” break > database side or can I just go on running the app as is. Nothing will break on the database size. > Do we need to restart databases or something else that requires an > interrupted service? No, you just run ALTER the_table ALTER COLUMN organisational TYPE varchar(80); It requires an exclusive lock on the table, but the actual operation will finish in a few milliseconds because the table is not physically changed (as the limit is only increased). Getting the exlusive lock might take a while if the table is actively used, so the ALTER statement itself might look as it would take a while, but once the lock could be obtained the change is very fast. There is no real need to stop anything if you can anticipate that there will be a few (milli)seconds where the ALTER statement succeeds in obtainin (and releasing) the lock.
В списке pgsql-general по дате отправления: