pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14826: Malformed array dimensions for empty arrays in return column "lexemes" of ts_debug()
2+ messages / 2 participants
[nested] [flat]

* BUG #14826: Malformed array dimensions for empty arrays in return column "lexemes" of ts_debug()
@ 2017-09-23 12:57  brsaweda@gmail.com
  0 siblings, 1 reply; 2+ messages in thread

From: brsaweda@gmail.com @ 2017-09-23 12:57 UTC (permalink / raw)
  To: pgsql-bugs; +Cc: brsaweda@gmail.com

The following bug has been logged on the website:

Bug reference:      14826
Logged by:          Erwin Brandstetter
Email address:      brsaweda@gmail.com
PostgreSQL version: 9.6.5
Operating system:   any
Description:        

Empty strings in this column seem to be "out of this world" - comparison to
'{}'::text[] returns FALSE:

test=# SELECT token, lexemes, lexemes = '{}'::text[]
test-# FROM   ts_debug('a title');
 token | lexemes | ?column?
-------+---------+----------
 a     | {}      | f
       |         |
 title | {titl}  | f

The root of the problem seems to be malformed array dimensions.
array_dims(lexemes) returns [1:0], while I would expect NULL:

test=# SELECT token, dictionaries, lexemes
test-#      , array_dims(lexemes) AS lex_dims
test-#      , array_dims(dictionaries) AS dict_dims
test-# FROM   ts_debug('a title');
 token |  dictionaries  | lexemes | lex_dims | dict_dims
-------+----------------+---------+----------+-----------
 a     | {english_stem} | {}      | [1:0]    | [1:1]
       | {}             |         |          |
 title | {english_stem} | {titl}  | [1:1]    | [1:1]

I tested in versions 8.4 to 10 Beta, always the same result.

Related question on dba.stackexchange:
https://dba.stackexchange.com/questions/186715/how-do-i-select-arrays-that-are-not-empty


Regards
Erwin Brandstetter


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #14826: Malformed array dimensions for empty arrays in return column "lexemes" of ts_debug()
@ 2017-09-23 16:26  Tom Lane <tgl@sss.pgh.pa.us>
  parent: brsaweda@gmail.com
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2017-09-23 16:26 UTC (permalink / raw)
  To: brsaweda@gmail.com; +Cc: pgsql-bugs

brsaweda@gmail.com writes:
> test=# SELECT token, lexemes, lexemes = '{}'::text[]
> test-# FROM   ts_debug('a title');
>  token | lexemes | ?column?
> -------+---------+----------
>  a     | {}      | f
>        |         |
>  title | {titl}  | f

> The root of the problem seems to be malformed array dimensions.
> array_dims(lexemes) returns [1:0], while I would expect NULL:

Yeah, that's a bug --- looks like ts_lexize is the root problem.

I'm a bit tempted to fix this centrally by having construct_array()
do something different for zero-dimensioned input, rather than
putting a special case into ts_lexize().  We've been bitten by
this type of insect a few times too many.  The question is
whether there's any code that relies on being able to construct
such malformed arrays ...

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-09-23 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-23 12:57 BUG #14826: Malformed array dimensions for empty arrays in return column "lexemes" of ts_debug() brsaweda@gmail.com
2017-09-23 16:26 ` Tom Lane <tgl@sss.pgh.pa.us>

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