split_part bug

Started by John Hansenabout 21 years ago5 messages
#1John Hansen
john@geeknet.com.au

PostgreSQL 8.0b4 as released.

select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',1);
select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',2);
select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',3);
select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',4);

should return a b c, and d
returns a, null, null, null

select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',2);
select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',3);
select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',4);

should return b c, and d
returns b, c, null

... John

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: John Hansen (#1)
Re: [HACKERS] split_part bug

John Hansen <john@geeknet.com.au> writes:

PostgreSQL 8.0b4 as released.
select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',1);
select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',2);
select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',3);
select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y
z',' ',4);

should return a b c, and d
returns a, null, null, null

Works fine for me. What encoding/locale are you using?

regards, tom lane

#3John Hansen
john@geeknet.com.au
In reply to: Tom Lane (#2)
Re: [HACKERS] split_part bug

Works fine for me. What encoding/locale are you using?

unicode / c

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: John Hansen (#3)
Re: [HACKERS] split_part bug

John Hansen <john@geeknet.com.au> writes:

Works fine for me. What encoding/locale are you using?

unicode / c

[ shrug... ] Works fine for me in unicode, too.

u=# select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y z',' ',1);
split_part
------------
a
(1 row)

u=# select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y z',' ',2);
split_part
------------
b
(1 row)

u=# select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y z',' ',3);
split_part
------------
c
(1 row)

u=# select split_part('a b c d e f g h i j k l m n o p q r s t u v w x y z',' ',4);
split_part
------------
d
(1 row)

regards, tom lane

#5John Hansen
john@geeknet.com.au
In reply to: Tom Lane (#4)
Re: [HACKERS] split_part bug

[ shrug... ] Works fine for me in unicode, too.

never mind me,. I broke it.....

seems my assumption that UCS2 == UTF16 was way off....

... john