Re: Minor error

2020-03-05 Thread Daniel Gustafsson
> On 28 Feb 2020, at 15:50, PG Doc comments form  wrote:
> 
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/12/indexes-partial.html
> Description:
> 
> A sentence on this page reads:
> "The system can recognize simple inequality implications, for example “x <
> 1” implies “x < 2”; otherwise the predicate condition must exactly match
> part of the query's WHERE condition or the index will not be recognized as
> usable."
> 
> I think it's supposed to read ..."x <=1" implies "x < 2"... ?

Why do you think that? x < 1 clearly implies x < 2 so I don't see what is wrong.

cheers ./daniel





Re: Incomplete or misleading explanation of the data types for mathematical operators

2020-03-05 Thread Bruce Momjian
On Wed, Jan 29, 2020 at 07:35:18PM +, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/12/functions-math.html
> Description:
> 
> "The bitwise operators work only on integral data types, whereas the others
> are available for all numeric data types. "
> Many math operators silently convert integral data types to double for
> calculations, so the result will not be the same data type as what was
> provided.
> select pg_typeof(10^2::bigint),pg_typeof(10^2::numeric)
> select pg_typeof(|/25::int), pg_typeof(|/25::numeric)
> select pg_typeof(10*10::bigint), pg_typeof(10*10::numeric) 
> 
> Multiplication preserves data type, exponentiation silently converts bigint
> to double, but preserves numeric data type, square root silently converts
> both int and numeric types to double.
> The best would be to explain this behaivior of operators like it was done
> for mathematical functions.

Uh, how does this relate to bitwise operators?  Why would we mention
type changes for things like exponentiation in the bitwise operator
documentation section?

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

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




Re: Incomplete or misleading explanation of the data types for mathematical operators

2020-03-05 Thread Sergei Agalakov

On 3/5/2020 7:29 PM, Bruce Momjian wrote:

On Wed, Jan 29, 2020 at 07:35:18PM +, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/functions-math.html
Description:

"The bitwise operators work only on integral data types, whereas the others
are available for all numeric data types. "
Many math operators silently convert integral data types to double for
calculations, so the result will not be the same data type as what was
provided.
select pg_typeof(10^2::bigint),pg_typeof(10^2::numeric)
select pg_typeof(|/25::int), pg_typeof(|/25::numeric)
select pg_typeof(10*10::bigint), pg_typeof(10*10::numeric)

Multiplication preserves data type, exponentiation silently converts bigint
to double, but preserves numeric data type, square root silently converts
both int and numeric types to double.
The best would be to explain this behaivior of operators like it was done
for mathematical functions.

Uh, how does this relate to bitwise operators?  Why would we mention
type changes for things like exponentiation in the bitwise operator
documentation section?

This chapter is named "Mathematical Functions and Operators". The table 
9.4. is named "Mathematical Operators". I don't see on this page any 
section "Bitwise operators" so I don't really understand your complaint.
How do you understand the phrase "The bitwise operators work only on 
integral data types, whereas the others are available for all numeric 
data types. "  in the context of the table "Mathematical Operators"?
I understand it that all other mathematical operators except bitwise 
operators do exist for all numeric data type.
In what place by your opinion documentation should describe that some 
mathematical operators exist only for some numeric data types but not 
others?
I have given examples of such operators - exponentiation and square root 
aren't defined for all numeric data types and do hidden conversion of 
the data types.