On 16 January 2013 05:40, Kevin Grittner <kgri...@mail.com> wrote:

> Here is a new version of the patch, with most issues discussed in
> previous posts fixed.
>
> I've been struggling with two areas:
>
>  - pg_dump sorting for MVs which depend on other MVs
>  - proper handling of the relisvalid flag for unlogged MVs after recovery
>

Some weirdness:

postgres=# CREATE VIEW v_test2 AS SELECT 1 moo;
CREATE VIEW
postgres=# CREATE MATERIALIZED VIEW mv_test2 AS SELECT moo, 2*moo FROM
v_test2 UNION ALL SELECT moo, 3*moo FROM v_test2;
SELECT 2
postgres=# \d+ mv_test2
                  Materialized view "public.mv_test2"
  Column  |  Type   | Modifiers | Storage | Stats target | Description
----------+---------+-----------+---------+--------------+-------------
 moo      | integer |           | plain   |              |
 ?column? | integer |           | plain   |              |
View definition:
 SELECT "*SELECT* 1".moo, "*SELECT* 1"."?column?";
Has OIDs: no

The "weirdness" I refer you to is the view definition.  This does not occur
with a straightforward UNION.

This does not occur with a regular view:

postgres=# CREATE VIEW v_test3 AS SELECT moo, 2*moo FROM v_test2 UNION ALL
SELECT moo, 3*moo FROM v_test2;
CREATE VIEW
postgres=# \d+ v_test3
                 View "public.v_test3"
  Column  |  Type   | Modifiers | Storage | Description
----------+---------+-----------+---------+-------------
 moo      | integer |           | plain   |
 ?column? | integer |           | plain   |
View definition:
         SELECT v_test2.moo, 2 * v_test2.moo
           FROM v_test2
UNION ALL
         SELECT v_test2.moo, 3 * v_test2.moo
           FROM v_test2;

-- 
Thom

Reply via email to