pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: vodevsh@gmail.com
To: pgsql-docs@postgresql.org
Subject: suggestion to make an example easier reproducible
Date: Thu, 04 May 2017 11:55:33 +0000
Message-ID: <20170504115533.24360.68520@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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, &#39;now&#39;);` to `RAISE INFO &#39;%&#39;,&#39;now&#39;::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 &#39;%&#39;,&#39;now&#39;::timestamptz;
        RETURN &#39;now&#39;;
    END;
$$ LANGUAGE plpgsql;


CREATE FUNCTION logfunc2() RETURNS timestamptz AS $$
    DECLARE
        curtime timestamp;
    BEGIN
        curtime := &#39;now&#39;;
        RAISE INFO &#39;%&#39;,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

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Message-ID: <20170504115533.24360.68520@wrigleys.postgresql.org>
Permalink:  ../20170504115533.24360.68520@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20170504115533.24360.68520@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: vodevsh@gmail.com
  Subject: Re: suggestion to make an example easier reproducible
  In-Reply-To: <20170504115533.24360.68520@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox