Re: Ambiguous usage of 'any' in explanation

2018-10-13 Thread KES
>or NULL if any of the comparisons result in unknownresult in unknown?? 13.10.2018, 00:37, "David G. Johnston" :On Fri, Oct 12, 2018 at 8:04 AM Bruce Momjian  wrote:Sorry, but I don't like this wording.  The problem is that the
comparison has two row sets --- the left-hand side, and the right-hand
side.Huh...the left hand side must be a non-set scalar or row constructor.  Each row on the left-hand side is compared with the row set on
the right.  I also don't like people thinking about the result of ANY
since it is really  ANY that is being used.Then there is some more rewording to be done since: "The result of ANY is “true” if any true result is obtained." (v10; 9.22.4)Maybe:The result of ANY is “true” if the comparison returns true for any subquery row; otherwise the result is “false” (or NULL if any of the comparisons result in unknown)David J.




Re: Ambiguous usage of 'any' in explanation

2018-10-13 Thread Bruce Momjian
On Sat, Oct 13, 2018 at 12:25:38PM +0300, KES wrote:
> >or NULL if any of the comparisons result in unknown
> result in unknown??

Well, SQL has a three-valued logic, and UNKOWN values are treated like
NULL.  For me they have always been the same, and I would like to avoid
"unknown" in this context, if possible.

---

> 13.10.2018, 00:37, "David G. Johnston" :
> 
> On Fri, Oct 12, 2018 at 8:04 AM Bruce Momjian  wrote:
> 
> Sorry, but I don't like this wording.  The problem is that the
> comparison has two row sets --- the left-hand side, and the right-hand
> side.
> 
> 
> Huh...the left hand side must be a non-set scalar or row constructor.
> 
> 
>   Each row on the left-hand side is compared with the row set on
> the right.  I also don't like people thinking about the result of ANY
> since it is really  ANY that is being used.
> 
> 
> Then there is some more rewording to be done since: "The result of ANY is
> “true” if any true result is obtained." (v10; 9.22.4)
> 
> Maybe:
> 
> The result of ANY is “true” if the comparison returns true for any 
> subquery
> row; otherwise the result is “false” (or NULL if any of the comparisons
> result in unknown)
> 
> David J.
> 
> 

-- 
  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 +



Re: Creating Certificates

2018-10-13 Thread Bruce Momjian
On Sat, Oct  6, 2018 at 08:17:04AM +0900, Tatsuo Ishii wrote:
> In "18.9.3. Creating Certificates",
> 
> --
> To create a server certificate whose identity can be validated by
> clients, first create a certificate signing request (CSR) and a
> public/private key file:
> 
> openssl req -new -nodes -text -out root.csr \
>   -keyout root.key -subj "/CN=root.yourdomain.com"
> chmod og-rwx root.key
> 
> Then, sign the request with the key to create a root certificate
> authority (using the default OpenSSL configuration file location on
> Linux):
> 
> openssl x509 -req -in root.csr -text -days 3650 \
>   -extfile /etc/ssl/openssl.cnf -extensions v3_ca \
>   -signkey root.key -out root.crt
> --
> 
> For me it seesm the two-step procedure can be replaced with following
> one command:
> 
> openssl req -new -x509 -nodes -text -days 3650 \
>   -config /etc/ssl/openssl.cnf -extensions v3_ca \
>   -out root.crt -keyout root.key -subj "/CN=root.yourdomain.com"
> 
> Is there any reason why our doc recommend the two-step procedure?

This was changed as part of this commit:

commit 815f84aa166de294b80e80cc456b79128592720e
Author: Bruce Momjian 
Date:   Sat Jan 20 21:47:02 2018 -0500

doc:  update intermediate certificate instructions

Document how to properly create root and intermediate certificates 
using
v3_ca extensions and where to place intermediate certificates so 
they
are properly transferred to the remote side with the leaf 
certificate to
link to the remote root certificate.  This corrects docs that used 
to
say that intermediate certificates must be stored with the root
certificate.

Also add instructions on how to create root, intermediate, and leaf
certificates.

Discussion: https://postgr.es/m/20180116002238.gc12...@momjian.us

Reviewed-by: Michael Paquier

Backpatch-through: 9.3

The reason I did this in two steps was so I could explain each step
independently, and because the next paragraph, "create a server
certificate signed by the new root certificate authority", also requires
two steps.  My goal was that the first command in each example creates
the CSR and public key pair, and the second command signs it.  If the
first example uses only one command, and the second example needs to use
two commands, and it appears more complex.

I guess we could show the single-command example as an alternative, but
that seems more complex too.

-- 
  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 +



Re: v11: RETURN syntax for procedure

2018-10-13 Thread Bruce Momjian
On Wed, Oct 10, 2018 at 10:14:23PM +0900, fn ln wrote:
> Hello.
> 
> I've found this on the docs:
> https://www.postgresql.org/docs/devel/static/plpgsql-control-structures.html#
> PLPGSQL-STATEMENTS-RETURNING-PROCEDURE
> > If a RETURN statement is desired to exit the code early, then NULL must be
> returned.
> 
> But isn't actual syntax just RETURN without an expression?

I think you might be right:

CREATE OR REPLACE PROCEDURE triple()
LANGUAGE plpgsql
AS $$
BEGIN
RETURN NULL;
END;
$$;
ERROR:  RETURN cannot have a parameter in a procedure
--> LINE 5: RETURN NULL;
   ^

CREATE OR REPLACE PROCEDURE triple()
LANGUAGE plpgsql
AS $$
BEGIN
RETURN;
END;
$$;

-- 
  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 +