Re: Retrieving the original table of a tuple stored in a tuplestore?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Spencer Pearson <crzybggr(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Retrieving the original table of a tuple stored in a tuplestore?
Date: 2011-06-27 04:02:59
Message-ID: 24685.1309147379@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Spencer Pearson <crzybggr(at)gmail(dot)com> writes:
> The way I understand the code, tuples stored in tuplestores do not also
> store the TupleDesc or a way to access the original table the tuple came
> from. This - again, as I understand the code - would make it impossible to
> know what types of attributes are stored in the tuple.

I think there are two different questions there.

1. A tuplestore has an associated TupleDesc, which must describe all
tuples stored into the tuplestore. The individual tuples aren't
individually self-describing, but the information as to what columns
they contain is certainly available.

2. While the TupleDesc only explicitly describes the "user" columns,
actual practice is that we store MinimalTuples, which don't include any
system columns and particularly not tableoid.

So no, there's no automatic solution for what you want. But perhaps you
could carry the tableoid as a "user" column that's explicitly present in
the stored tuples.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob Gansevles 2011-06-27 06:50:45 Re: Reusing cached prepared statement slow after 5 executions
Previous Message David Johnston 2011-06-27 03:39:43 Re: to_timestamp() and timestamp without time zone