Jan Wieck <JanWieck@yahoo.com> writes:
>     For  all  the  default operations, the system would treat the
>     datums still like regular attributes. That means, that an
>         INSERT ... SELECT ...
>     copying a BLOB from one table to another (and that's correct,
>     BLOB's  should  have  copy  semantics) would force the entire
>     BLOB data into memory ... and ...  then ...  after  ...  some
>     ... time ... run out of memory.
This does not seem expensive or difficult to solve.  tuptoaster.c
will be handed a TOAST pointer as part of heap_insert, and it will
know that it has to duplicate the value.  It seems an easy, localized
change to persuade it to do that copying chunk-at-a-time instead of
suck-it-all-in-then-spew-it-all-out.
        regards, tom lane