Database migration chokes on huge value of a "calendar-details" item in table "post_custom_fields"

Following Upgrade of postgres failed and PostgreSQL 12 update, we haven’t been able to identify anything particular which might help us here.

This installation isn’t particular large

root@pulp:/srv/www/organizations/panodata/ du -sch .
661M	total

and trying to launch the application again in order

fails, as the Rails app can’t connect to PostgreSQL:

==> shared/standalone/log/rails/unicorn.stderr.log <==
I, [2020-12-07T12:20:58.960126 #459]  INFO -- : Refreshing Gem list
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad)
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
	from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `new'
	from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `connect'