From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | "David E(dot) Wheeler" <david(at)kineticode(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, Dave Page <dpage(at)pgadmin(dot)org>, BruceMomjian <bruce(at)momjian(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pg_class.relistemp |
Date: | 2011-07-15 01:43:30 |
Message-ID: | C3025505-452B-4F00-B697-A2890579EF45@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Jul 14, 2011, at 5:13 PM, "David E. Wheeler" <david(at)kineticode(dot)com> wrote:
> On Jul 14, 2011, at 3:05 PM, Tom Lane wrote:
>
>> Josh Berkus <josh(at)agliodbs(dot)com> writes:
>>>> There are a ton of
>>>> things that change with each release, and all we do by putting in
>>>> hacks for backwards compatibility is add bloat that needs to be
>>>> maintained, and encourage vendors to be lazy.
>>
>>> I don't agree that having comprehensive system views with multi-version
>>> stability would be a "hack".
>>
>> If we had that, it wouldn't be a hack.
>
> Is that an endorsement for adding such a feature?
>
>> Putting in a hack to cover the
>> specific case of relistemp, on the other hand, is just a hack.
>
> Sure.
>
>> The real question here, IMO, is "how many applications are there that
>> really need to know about temporary relations, but have no interest in
>> the related feature of unlogged relations?". Because only such apps
>> would be served by a compatibility hack for this. An app that thinks it
>> knows the semantics of relistemp, and isn't updated to grok unlogged
>> tables, may be worse than broken --- it may be silently incorrect.
>
> So pgTAP creates temporary tables to store result sets so that it can then compare the results of two queries. The function in question was getting a list of columns in such a temporary table in order to make sure that the types were the same between two such tables before comparing results. It checked relistemp to make sure it was looking at the temp table rather than some other table that might happen to have the same name.
>
> So now the query looks like this:
>
> SELECT pg_catalog.format_type(a.atttypid, a.atttypmod)
> FROM pg_catalog.pg_attribute a
> JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
> WHERE c.relname = $1
> -- AND c.relistemp -- 8.3-9.0
> AND c.relpersistence = 't' -- 9.1
> AND attnum > 0
> AND NOT attisdropped
> ORDER BY attnum
>
> Is that all I need to do, or is there something else I should be aware of with regard to unlogged tables?
Probably not, in this case. Just a thought: maybe you could rewrite the query to check whether the namespace name starts with pg_temp. Maybe that would be version-independent...
...Robert
From | Date | Subject | |
---|---|---|---|
Next Message | David E. Wheeler | 2011-07-15 01:58:38 | Re: pg_class.relistemp |
Previous Message | Pavan Deolasee | 2011-07-14 23:56:03 | Re: Single pass vacuum - take 1 |