Re: Improve documentation for current_setting function

2019-02-21 Thread Bruce Momjian
On Wed, Feb 20, 2019 at 12:59:45PM +, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/11/functions-admin.html
> Description:
> 
> Hi.
> 
> Doc is not clear about what is returned if current_setting(
> 'app.not_existent', true ) is called.
> 
> Does it return empty string '', because return type is 'text' or it return
> NULL, because 'app.not_existent' does not exist

Testing shows:

SELECT current_setting('asdf', true);
 current_setting
-


\pset null (null)

SELECT current_setting('asdf', true);
 current_setting
-
-->  (null)

How do you like the attached patch, which clarifies this?

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+  Ancient Roman grave inscription +
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
new file mode 100644
index 86ff4e5..f638c6d
*** a/doc/src/sgml/func.sgml
--- b/doc/src/sgml/func.sgml
*** SELECT current_setting('datestyle');
*** 18722,18728 
  If there is no setting named setting_name,
  current_setting throws an error
  unless missing_ok is supplied and is
! true.
 
  
 
--- 18722,18729 
  If there is no setting named setting_name,
  current_setting throws an error
  unless missing_ok is supplied and is
! true, in which case a missing parameter returns
! NULL.
 
  
 


Re: Improve examples for range operators

2019-02-21 Thread Bruce Momjian
On Wed, Feb 20, 2019 at 12:27:26PM +, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/11/functions-range.html
> Description:
> 
> Hi.
> 
> It would be nice if next examples:
> 
> < >>strictly right of   int8range(50,60) >> int8range(20,30)t
> & int8range(18,20)
>   t
> &>does not extend to the left of  int8range(7,20) &> int8range(5,10)  
> t
> 
> are extended by:
> **not** strictly left of, **not** strictly right of, **extends** to the
> right of, **extends** to the left of
> 
> Because without manual experiments I can not imagine the ranges that cause
> 'false' result for the examples above.

Well, they are not technically negatives of each other.  << means the
first is all left of the second, while &< means that it doesn't go to
the right of the second, e.g.,

SELECT int8range(1,10) &< int8range(100,110);
 ?column?
--
 t

SELECT int8range(1,105) &< int8range(100,110);
 ?column?
--
 t

SELECT int8range(1,200) &< int8range(100,110);
 ?column?
--
 f

Notice it changed from true to false and none of these was strictly to
the right.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+  Ancient Roman grave inscription +