[DOCS] suggestion to make an example easier reproducible - Mailing list pgsql-docs

From vodevsh@gmail.com
Subject [DOCS] suggestion to make an example easier reproducible
Date
Msg-id 20170504115533.24360.68520@wrigleys.postgresql.org
Whole thread Raw
List pgsql-docs
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.6/static/plpgsql-implementation.html
Description:

Documentation is good. But if you change `INSERT INTO logtable VALUES
(logtxt, 'now');` to `RAISE INFO '%','now'::timestamptz;` in example, people
will probably try it out to see how caching works (no need to create table).
Also could explain why RETURNED value is reparsed and recalculated, while
RAISEd - not:
CREATE FUNCTION logfunc1() RETURNS timestamptz AS $$
    BEGIN
        RAISE INFO '%','now'::timestamptz;
        RETURN 'now';
    END;
$$ LANGUAGE plpgsql;


CREATE FUNCTION logfunc2() RETURNS timestamptz AS $$
    DECLARE
        curtime timestamp;
    BEGIN
        curtime := 'now';
        RAISE INFO '%',curtime::timestamptz;
        RETURN curtime;
    END;
$$ LANGUAGE plpgsql;

t=# select logfunc1(),logfunc2();
INFO:  2017-05-04 11:49:34.828784+00
INFO:  2017-05-04 11:49:34.828784+00
           logfunc1            |           logfunc2
-------------------------------+-------------------------------
 2017-05-04 11:49:34.828784+00 | 2017-05-04 11:49:34.828784+00
(1 row)

t=# select logfunc1(),logfunc2();
INFO:  2017-05-04 11:49:34.828784+00
INFO:  2017-05-04 11:49:39.661306+00
           logfunc1            |           logfunc2
-------------------------------+-------------------------------
 2017-05-04 11:49:39.661306+00 | 2017-05-04 11:49:39.661306+00
(1 row)

Thank you

pgsql-docs by date:

Previous
From: Peter Eisentraut
Date:
Subject: [DOCS] release date formatting
Next
From: Magnus Hagander
Date:
Subject: Re: [DOCS] Wording in pg_upgrade IMPLEMENTATION