Re: Error with temporary tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Claire McLister <mclister(at)zeesource(dot)net>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql general list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Error with temporary tables
Date: 2006-02-04 19:24:03
Message-ID: 20736.1139081043@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Claire McLister <mclister(at)zeesource(dot)net> writes:
> This was all working fine until E.Value became some large strings
> with some occasional funny characters.

> The hack that solved the problem was:

> R.Field := substring(E.Value from 1);

> This is a complete hack, so I'd like to find out what is going
> wrong and why this worked. For now, it keeps the system functional.

Oooh. You were probably dealing with values that had gotten large
enough to be "toasted", ie, stored out-of-line in a TOAST table.
So the datum being passed around in memory was just a pointer to the
row in the TOAST table. Dropping the temp table made its TOAST table
go away, resulting in a dangling pointer stored in the plpgsql variable.

The easy fix would be to forcibly detoast any value stored into a
plpgsql variable, but the performance implications of that seem a
bit nasty. Not sure I want to do it for such a weird corner case...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Claire McLister 2006-02-04 22:10:43 Re: Error with temporary tables
Previous Message Claire McLister 2006-02-04 19:04:14 Re: Error with temporary tables