From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Too short field
Date: Wed, 3 Jul 2019 13:56:03 +0200
Message-ID: <b56469aa-4a9c-f678-a950-39fdcd43fb97@gmx.net> (raw)
In-Reply-To: <78d5b939297348b8856d457be7a63e7e@UKEXCHMBX003.TechMahindra.com>
References: <78d5b939297348b8856d457be7a63e7e@UKEXCHMBX003.TechMahindra.com>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: Too short field
In-Reply-To: <b56469aa-4a9c-f678-a950-39fdcd43fb97@gmx.net>
References: <78d5b939297348b8856d457be7a63e7e@UKEXCHMBX003.TechMahindra.com> <b56469aa-4a9c-f678-a950-39fdcd43fb97@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox