pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: alexey.kruchkov@gmail.com
Subject: BUG #15259: intarray extension operator "&" produces invalid dimensions [1:0] for empty arrays
Date: Mon, 02 Jul 2018 12:00:51 +0000
Message-ID: <153053285112.13258.434620894305716755@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15259
Logged by:          Alexey Kryuchkov
Email address:      alexey.kruchkov@gmail.com
PostgreSQL version: 10.4
Operating system:   verified on Ubuntu 14.04, 17.10
Description:        

Intarray extension operator '&' returns empty arrays of invalid size, which
are
not equal to 'normal' empty arrays despite having the same textual
representation:

    test=# CREATE TABLE a AS SELECT '{1}'::int[] & '{2}'::int[] AS x;
    SELECT 1

    test=# SELECT x, x = '{}', ARRAY_DIMS(x) FROM a;
     x  | ?column? | array_dims
    ----+----------+------------
     {} | f        | [1:0]
    (1 row)


For comparison, operator '-' behaves correctly:

    test=# CREATE TABLE b AS SELECT '{1}'::int[] - '{1}'::int[] AS x;
    SELECT 1

    test=# SELECT x, x = '{}', ARRAY_DIMS(x) FROM b;
     x  | ?column? | array_dims
    ----+----------+------------
     {} | t        |
    (1 row)


This can be reproduced with both Postgres 10.4 and Postgres 11-beta1 (from
Docker library/postgres:11-beta1 image).

    test=# SELECT version();
                                                                  version
   
-----------------------------------------------------------------------------------------------------------------------------------
     PostgreSQL 10.4 (Ubuntu 10.4-2.pgdg14.04+1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4, 64-bit
    (1 row)

    postgres=# SELECT version();
                                                                    
version
   
-----------------------------------------------------------------------------------------------------------------------------------------
     PostgreSQL 11beta1 (Debian 11~beta1-2.pgdg90+1) on x86_64-pc-linux-gnu,
compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
    (1 row)


Looking through the commit history I've located commit
c155f654b4f755b4111bd9adb60559fe22526a10 from 2013 which seems to address
the
same issue in intarray module, so it might be a regression.

Also there is 716ea626a88ac510523ab3af5bc779d78eeced58 from 2017 which
fixes
the bug in construct_array function. This commit appears to be included in
REL_11_BETA1, therefore it does not fix the problem with intarray module.



Message-ID: <153053285112.13258.434620894305716755@wrigleys.postgresql.org>
Permalink:  ../153053285112.13258.434620894305716755@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/153053285112.13258.434620894305716755@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-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, alexey.kruchkov@gmail.com
  Subject: Re: BUG #15259: intarray extension operator "&" produces invalid dimensions [1:0] for empty arrays
  In-Reply-To: <153053285112.13258.434620894305716755@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