Re: Strange behaviors with ranges

2024-08-28 Thread Laurenz Albe
On Tue, 2024-08-27 at 19:29 +0200, Jean-Christophe Boggio wrote: > I have 2 very confusing behaviors when using ranges. > > It all started with this query: > > WITH rangespaliers AS ( > SELECT numrange( qtep1+1   , qtep2,  '[]') AS rangep FROM > paliers JOIN tmp_limitcontrats USING

Re: Strange behaviors with ranges

2024-08-27 Thread Jean-Christophe BOGGIO
Paul, Le 27/08/2024 à 20:11, Paul Jungwirth a écrit : The issue is the order-of-operations used by the planner. If I put EXPLAIN on your last query, I see:  Hash Join  (cost=16.64..109.90 rows=2410 width=64)    Hash Cond: (tmp_limitcontrats.idcontrat = paliers.idcontrat)    ->  Seq Scan on tmp

Re: Strange behaviors with ranges

2024-08-27 Thread Adrian Klaver
On 8/27/24 11:16 AM, Adrian Klaver wrote: On 8/27/24 11:13 AM, Jean-Christophe BOGGIO wrote: Le 27/08/2024 à 19:51, Torsten Förtsch a écrit : I guess this query comes back non-empty: SELECT * FROM paliers JOIN tmp_limitcontrats USING(idcontrat) WHERE qtep1 >= qtep2 Yes, it is empty if

Re: Strange behaviors with ranges

2024-08-27 Thread Adrian Klaver
On 8/27/24 11:13 AM, Jean-Christophe BOGGIO wrote: Le 27/08/2024 à 19:51, Torsten Förtsch a écrit : I guess this query comes back non-empty: SELECT * FROM paliers JOIN tmp_limitcontrats USING(idcontrat) WHERE qtep1 >= qtep2 Yes, it is empty if I keep tmp_limitcontrats to idcontrat=1003 O

Re: Strange behaviors with ranges

2024-08-27 Thread Jean-Christophe BOGGIO
Le 27/08/2024 à 19:51, Torsten Förtsch a écrit : I guess this query comes back non-empty: SELECT * FROM paliers JOIN tmp_limitcontrats USING(idcontrat) WHERE qtep1 >= qtep2 Yes, it is empty if I keep tmp_limitcontrats to idcontrat=1003 Otherwise, you are right, there are irregular data but n

Re: Strange behaviors with ranges

2024-08-27 Thread Paul Jungwirth
On 8/27/24 10:29, Jean-Christophe Boggio wrote: I have 2 very confusing behaviors when using ranges. It all started with this query:     WITH rangespaliers AS (     SELECT numrange( qtep1+1   , qtep2,  '[]') AS rangep FROM paliers JOIN tmp_limitcontrats USING(idcontrat) --    SELECT

Re: Strange behaviors with ranges

2024-08-27 Thread Torsten Förtsch
I guess this query comes back non-empty: SELECT * FROM paliers JOIN tmp_limitcontrats USING(idcontrat) WHERE qtep1 >= qtep2 This would then lead somewhere to this expression numrange(3,2) Check out idpalier=805 On Tue, Aug 27, 2024 at 7:37 PM Adrian Klaver wrote: > > > On 8/27/24 10:29 AM, J

Re: Strange behaviors with ranges

2024-08-27 Thread Jean-Christophe Boggio
What does: SELECT numrange( qtep1+1   , qtep2,  '[]') AS rangep FROM paliers WHERE idcontrat=1003 return? It returns: (,) (as expected)

Re: Strange behaviors with ranges

2024-08-27 Thread Adrian Klaver
On 8/27/24 10:29 AM, Jean-Christophe Boggio wrote: Hello, I have 2 very confusing behaviors when using ranges. It all started with this query:     WITH rangespaliers AS (     SELECT numrange( qtep1+1   , qtep2,  '[]') AS rangep FROM paliers JOIN tmp_limitcontrats USING(idcontrat) -- 

Strange behaviors with ranges

2024-08-27 Thread Jean-Christophe Boggio
Hello, I have 2 very confusing behaviors when using ranges. It all started with this query:     WITH rangespaliers AS (     SELECT numrange( qtep1+1   , qtep2,  '[]') AS rangep FROM paliers JOIN tmp_limitcontrats USING(idcontrat) --    SELECT numrange( qtep1+1   , qtep2,  '[]') AS rang