| From: | Matija Lesar <matija(dot)lesar(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Unexpected array_remove results |
| Date: | 2015-03-20 06:37:32 |
| Message-ID: | CAPx3hmNciq9Rn8R+GxmUCXCC8EiseTGsBvh9XBRHkasJQWioDQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi,
should not in example below array_remove return same results?
test1=# create temp table tmptest (trid text[]);
CREATE TABLE
test1=# insert into tmptest values(null::text[]);
INSERT 0 1
test1=# update tmptest set trid[2:4]='{b,NULL,d}';
UPDATE 1
test1=# select trid,array_remove(trid,
NULL::text),array_lower(array_remove(trid, NULL::text),
1),array_upper(array_remove(trid, NULL::text), 1) from tmptest;
trid | array_remove | array_lower | array_upper
------------------+--------------+-------------+-------------
[2:4]={b,NULL,d} | [2:3]={b,d} | 2 | 3
(1 row)
test1=# update tmptest set trid='{NULL,b,NULL,d}';
UPDATE 1
test1=# select trid,array_remove(trid,
NULL::text),array_lower(array_remove(trid, NULL::text),
1),array_upper(array_remove(trid, NULL::text), 1) from tmptest;
trid | array_remove | array_lower | array_upper
-----------------+--------------+-------------+-------------
{NULL,b,NULL,d} | {b,d} | 1 | 2
(1 row)
I expected that in both results values will start from index 1.
Regards,
Matija Lesar
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2015-03-20 13:58:15 | Re: Unexpected array_remove results |
| Previous Message | David G. Johnston | 2015-03-19 20:21:41 | Re: How does one make the following psql statement sql-injection resilient? |