suggestion to make an example easier reproducible

From: vodevsh(at)gmail(dot)com
To: pgsql-docs(at)postgresql(dot)org
Subject: suggestion to make an example easier reproducible
Date: 2017-05-04 11:55:33
Message-ID: 20170504115533.24360.68520@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-docs by date

  From Date Subject
Next Message Magnus Hagander 2017-05-05 10:43:30 Re: Wording in pg_upgrade IMPLEMENTATION
Previous Message Peter Eisentraut 2017-05-02 16:35:06 release date formatting