Re: Pg_upgrade and toast tables bug discovered - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Pg_upgrade and toast tables bug discovered
Date
Msg-id 20140711031852.GE7366@momjian.us
Whole thread Raw
In response to Re: Pg_upgrade and toast tables bug discovered  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Pg_upgrade and toast tables bug discovered  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On Thu, Jul 10, 2014 at 06:38:26PM -0400, Bruce Momjian wrote:
> On Thu, Jul 10, 2014 at 06:17:14PM -0400, Bruce Momjian wrote:
> > Well, we are going to need to call internal C functions, often bypassing
> > their typical call sites and the assumption about locking, etc.  Perhaps
> > this could be done from a plpgsql function.  We could add and drop a
> > dummy column to force TOAST table creation --- we would then only need a
> > way to detect if a function _needs_ a TOAST table, which was skipped in
> > binary upgrade mode previously.
> >
> > That might be a minimalistic approach.
>
> I have thought some more on this.  I thought I would need to open
> pg_class in C and do complex backend stuff, but I now realize I can do
> it from libpq, and just call ALTER TABLE and I think that always
> auto-checks if a TOAST table is needed.  All I have to do is query
> pg_class from libpq, then construct ALTER TABLE commands for each item,
> and it will optionally create the TOAST table if needed.  I just have to
> use a no-op ALTER TABLE command, like SET STATISTICS.
>
> I am in Asia the next two weeks but will work on it after I return.

Attached is the backend part of the patch.  I will work on the
pg_upgrade/libpq/ALTER TABLE part later.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +

Attachment

pgsql-hackers by date:

Previous
From: 土卜皿
Date:
Subject: Re: how many changes about backend mode from 7.2.2 to 8.4.0?
Next
From: Jeff Davis
Date:
Subject: Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING