Re: [BUGS] BUG #8542: Materialized View with another column_name does not work?

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: "t(dot)katsumata1122(at)gmail(dot)com" <t(dot)katsumata1122(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #8542: Materialized View with another column_name does not work?
Date: 2013-11-01 04:48:11
Message-ID: CAFjFpRcn8EtQrMXh8-TiDP_iAs=9h+aeezKGbTvpmxXsXs-OOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

CREATE MATERIALIZED VIEW statement ends up being CREATE TABLE AS statement
underneath with table type matview. In that case, why don't I see special
treatment only for materialized view and not CTAS in general, which allows
column names to specified like the case in the bug reported.

On Fri, Nov 1, 2013 at 3:52 AM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:

> "t(dot)katsumata1122(at)gmail(dot)com" <t(dot)katsumata1122(at)gmail(dot)com> wrote:
>
> > I'm testing the Materialized View.
> > When I've tried to create materialized view with specified
> > column_name, I got an ERROR.
> >
> > example:
> > - Creating original table
> > CREATE TABLE t ( i int );
> >
> > - Creating materialized view with column_name
> > CREATE MATERIALIZED VIEW mv_t(ii) AS SELECT * FROM t;
> >
> > And then, I got a bellow ERROR.
> > ----
> > ERROR: SELECT rule's target entry 1 has different column name from "ii"
> > ----
> >
> > I did not get any ERROR with non materialized view.
> > CREATE VIEW mv_t(ii) AS SELECT * FROM t;
> >
> > Is this a bug or restriction for Materialized View?
>
> It's a bug. Will fix in the next 9.3 minor release.
>
> Moving the discussion to the -hackers list to discuss the fix.
>
> This bug was introduced in fb60e7296c2cf15195802b4596496b179bdc905a
> based on this feedback:
>
> http://www.postgresql.org/message-id/20600.1363022702@sss.pgh.pa.us
>
> I picked the wrong response to that feedback. Attached is a patch
> which fixes things along the alternative lines suggested. This
> includes a regression test to ensure that this doesn't get broken
> again.
>
> If there are no objections I'll apply this within a few days.
>
> --
> Kevin Grittner
> EDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sergey Konoplev 2013-11-01 07:35:18 Re: Completely broken replica after PANIC: WAL contains references to invalid pages
Previous Message Michael Paquier 2013-11-01 01:58:06 Re: [BUGS] BUG #8542: Materialized View with another column_name does not work?

Browse pgsql-hackers by date

  From Date Subject
Next Message Christian Ullrich 2013-11-01 05:42:41 Re: [GENERAL] postgresql-9.3.1-1-windows-x64.exe does not install correctly for me
Previous Message Robert Haas 2013-11-01 04:28:00 Re: Shave a few instructions from child-process startup sequence