BUG #8606: Materialized View WITH NO DATA bug - Mailing list pgsql-bugs

From j.rejda@konektel.cz
Subject BUG #8606: Materialized View WITH NO DATA bug
Date
Msg-id E1VinLE-0005zJ-HB@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #8606: Materialized View WITH NO DATA bug  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      8606
Logged by:          Jaroslav Rejda
Email address:      j.rejda@konektel.cz
PostgreSQL version: 9.3.1
Operating system:   MS Windows XP SP3
Description:

-- Hi,
-- please, check this example:


-- simple table
CREATE TABLE test (cislo integer);
INSERT INTO test VALUES (10);


-- immutable "long time" math func
CREATE FUNCTION long_test(_n bigint)
  RETURNS bigint AS
$BODY$DECLARE
  _result bigint := 0;
  _i bigint := 2;
BEGIN
  _n := !! _n;
  WHILE _i < _n LOOP
    IF _n % _i = 0 THEN
      _result := _result + 1;
    END IF;
    _i := _i + 1;
  END LOOP;
  RETURN _result;
END;$BODY$
  LANGUAGE plpgsql IMMUTABLE STRICT
  COST 100;


-- this returns "immediately"
CREATE MATERIALIZED VIEW test1 AS SELECT long_test(cislo) FROM test WITH NO
DATA;


-- this returns "after some time" (as long as normal "SELECT long_test(10);"
do)
CREATE MATERIALIZED VIEW test2 AS SELECT long_test(10) WITH NO DATA;


-- it's ok or bug?
-- Thanks ... JR

pgsql-bugs by date:

Previous
From: Ronan Dunklau
Date:
Subject: Server may segfault when using slices on int2vector
Next
From: atoriwork@gmail.com
Date:
Subject: BUG #8605: Regular expression lazy quantification issue