Re: [HACKERS] [SQL] Postgresql “alter column type” creates an event which contains “temp_table_xxx” - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] [SQL] Postgresql “alter column type” creates an event which contains “temp_table_xxx”
Date
Msg-id 4792.1500992338@sss.pgh.pa.us
Whole thread Raw
Responses [HACKERS] Re: [SQL] Postgresql “alter column type” creates an event which contains “temp_table_xxx”
List pgsql-hackers
Zehra Gül Çabuk <zgul.cabuk@gmail.com> writes:
>  => ALTER TABLE test ALTER COLUMN x TYPE integer USING
> (trim(x)::integer);ALTER TABLE
> Last command I've executed to alter column data type creates an event like
> this:
> BEGIN 500913table public.pg_temp_1077668: INSERT: x[integer]:14table
> public.pg_temp_1077668: INSERT: x[integer]:42COMMIT 500913
> How could I find "real" table name using this record? Is there any way to
> see real table name in fetched record?

That is the real name --- table rewrites create a table with a temporary
name and the desired new column layout, then fill it with data, then
exchange the data area with the old table, then drop the temp table.

Evidently logical decoding is exposing some of this infrastructure
to you.  I bet it isn't exposing the critical "swap data" step though,
so I wonder how exactly a logical decoding plugin is supposed to make
sense of what it can see here.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] cache lookup failed error for partition key with custom opclass
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] pl/perl extension fails on Windows