mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
I have two patches for 6.5.0:
arrayfuncs.patch fixes a small bug in my previous patches for arrays array-regress.patch adds _bpchar and _varchar to regression tests -- Massimo Dal Zotto
This commit is contained in:
parent
81ff51615d
commit
5d5cf912bc
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.40 1999/05/03 23:48:26 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.41 1999/05/05 21:38:37 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1336,10 +1336,16 @@ array_map(ArrayType *v,
|
|||||||
system_cache_lookup(retType, false, &typlen, &typbyval,
|
system_cache_lookup(retType, false, &typlen, &typbyval,
|
||||||
&typdelim, &typelem, &proc, &typalign);
|
&typdelim, &typelem, &proc, &typalign);
|
||||||
|
|
||||||
/* Allocate temporary array for new values */
|
|
||||||
ndim = ARR_NDIM(v);
|
ndim = ARR_NDIM(v);
|
||||||
dim = ARR_DIMS(v);
|
dim = ARR_DIMS(v);
|
||||||
nitems = getNitems(ndim, dim);
|
nitems = getNitems(ndim, dim);
|
||||||
|
|
||||||
|
/* Check for empty array */
|
||||||
|
if (nitems <= 0) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate temporary array for new values */
|
||||||
values = (char **) palloc(nitems * sizeof(char *));
|
values = (char **) palloc(nitems * sizeof(char *));
|
||||||
MemSet(values, 0, nitems * sizeof(char *));
|
MemSet(values, 0, nitems * sizeof(char *));
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
QUERY: SELECT * FROM arrtest;
|
QUERY: SELECT * FROM arrtest;
|
||||||
a |b |c |d |e
|
a |b |c |d |e |f |g
|
||||||
-----------+---------------+-------------+-----------------+-------------
|
-----------+---------------+-------------+-----------------+-------------+-----------------+---------------
|
||||||
{1,2,3,4,5}|{{{0,0},{1,2}}}|{} |{} |
|
{1,2,3,4,5}|{{{0,0},{1,2}}}|{} |{} | |{} |{}
|
||||||
{11,12,23} |{{3,4},{4,5}} |{"foobar"} |{{"elt1","elt2"}}|{"3.4","6.7"}
|
{11,12,23} |{{3,4},{4,5}} |{"foobar"} |{{"elt1","elt2"}}|{"3.4","6.7"}|{"abc ","abcde"}|{"abc","abcde"}
|
||||||
{} |{3,4} |{"foo","bar"}|{"bar","foo"} |
|
{} |{3,4} |{"foo","bar"}|{"bar","foo"} | | |
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
QUERY: SELECT arrtest.a[1],
|
QUERY: SELECT arrtest.a[1],
|
||||||
@ -43,8 +43,8 @@ QUERY: SELECT *
|
|||||||
FROM arrtest
|
FROM arrtest
|
||||||
WHERE arrtest.a[1] < 5 and
|
WHERE arrtest.a[1] < 5 and
|
||||||
arrtest.c = '{"foobar"}'::_name;
|
arrtest.c = '{"foobar"}'::_name;
|
||||||
a|b|c|d|e
|
a|b|c|d|e|f|g
|
||||||
-+-+-+-+-
|
-+-+-+-+-+-+-
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
QUERY: SELECT arrtest.a[1:3],
|
QUERY: SELECT arrtest.a[1:3],
|
||||||
|
@ -114,13 +114,14 @@ QUERY: INSERT INTO f_star (class, e) VALUES ('f', '-12'::int2);
|
|||||||
QUERY: INSERT INTO f_star (class, f)
|
QUERY: INSERT INTO f_star (class, f)
|
||||||
VALUES ('f', '(11111111,33333333),(22222222,44444444)'::polygon);
|
VALUES ('f', '(11111111,33333333),(22222222,44444444)'::polygon);
|
||||||
QUERY: INSERT INTO f_star (class) VALUES ('f');
|
QUERY: INSERT INTO f_star (class) VALUES ('f');
|
||||||
QUERY: INSERT INTO arrtest (a[5], b[2][1][2], c, d)
|
QUERY: INSERT INTO arrtest (a[5], b[2][1][2], c, d, f, g)
|
||||||
VALUES ('{1,2,3,4,5}', '{{{},{1,2}}}', '{}', '{}');
|
VALUES ('{1,2,3,4,5}', '{{{},{1,2}}}', '{}', '{}', '{}', '{}');
|
||||||
QUERY: UPDATE arrtest SET e[0] = '1.1';
|
QUERY: UPDATE arrtest SET e[0] = '1.1';
|
||||||
QUERY: UPDATE arrtest SET e[1] = '2.2';
|
QUERY: UPDATE arrtest SET e[1] = '2.2';
|
||||||
QUERY: INSERT INTO arrtest (a, b[2][2][1], c, d, e)
|
QUERY: INSERT INTO arrtest (a, b[2][2][1], c, d, e, f, g)
|
||||||
VALUES ('{11,12,23}', '{{3,4},{4,5}}', '{"foobar"}',
|
VALUES ('{11,12,23}', '{{3,4},{4,5}}', '{"foobar"}',
|
||||||
'{{"elt1", "elt2"}}', '{"3.4", "6.7"}');
|
'{{"elt1", "elt2"}}', '{"3.4", "6.7"}',
|
||||||
|
'{"abc","abcdefgh"}', '{"abc","abcdefgh"}');
|
||||||
QUERY: INSERT INTO arrtest (a, b[1][2][2], c, d[2][1])
|
QUERY: INSERT INTO arrtest (a, b[1][2][2], c, d[2][1])
|
||||||
VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}');
|
VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}');
|
||||||
QUERY: CREATE TABLE iportaltest (
|
QUERY: CREATE TABLE iportaltest (
|
||||||
|
@ -131,7 +131,9 @@ QUERY: CREATE TABLE arrtest (
|
|||||||
b int4[][][],
|
b int4[][][],
|
||||||
c name[],
|
c name[],
|
||||||
d text[][],
|
d text[][],
|
||||||
e float8[]
|
e float8[],
|
||||||
|
f char(5)[],
|
||||||
|
g varchar(5)[]
|
||||||
);
|
);
|
||||||
QUERY: CREATE TABLE hash_i4_heap (
|
QUERY: CREATE TABLE hash_i4_heap (
|
||||||
seqno int4,
|
seqno int4,
|
||||||
|
@ -198,16 +198,17 @@ INSERT INTO f_star (class) VALUES ('f');
|
|||||||
-- 'e' is also a large object.
|
-- 'e' is also a large object.
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO arrtest (a[5], b[2][1][2], c, d)
|
INSERT INTO arrtest (a[5], b[2][1][2], c, d, f, g)
|
||||||
VALUES ('{1,2,3,4,5}', '{{{},{1,2}}}', '{}', '{}');
|
VALUES ('{1,2,3,4,5}', '{{{},{1,2}}}', '{}', '{}', '{}', '{}');
|
||||||
|
|
||||||
UPDATE arrtest SET e[0] = '1.1';
|
UPDATE arrtest SET e[0] = '1.1';
|
||||||
|
|
||||||
UPDATE arrtest SET e[1] = '2.2';
|
UPDATE arrtest SET e[1] = '2.2';
|
||||||
|
|
||||||
INSERT INTO arrtest (a, b[2][2][1], c, d, e)
|
INSERT INTO arrtest (a, b[2][2][1], c, d, e, f, g)
|
||||||
VALUES ('{11,12,23}', '{{3,4},{4,5}}', '{"foobar"}',
|
VALUES ('{11,12,23}', '{{3,4},{4,5}}', '{"foobar"}',
|
||||||
'{{"elt1", "elt2"}}', '{"3.4", "6.7"}');
|
'{{"elt1", "elt2"}}', '{"3.4", "6.7"}',
|
||||||
|
'{"abc","abcdefgh"}', '{"abc","abcdefgh"}');
|
||||||
|
|
||||||
INSERT INTO arrtest (a, b[1][2][2], c, d[2][1])
|
INSERT INTO arrtest (a, b[1][2][2], c, d[2][1])
|
||||||
VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}');
|
VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}');
|
||||||
|
@ -178,7 +178,9 @@ CREATE TABLE arrtest (
|
|||||||
b int4[][][],
|
b int4[][][],
|
||||||
c name[],
|
c name[],
|
||||||
d text[][],
|
d text[][],
|
||||||
e float8[]
|
e float8[],
|
||||||
|
f char(5)[],
|
||||||
|
g varchar(5)[]
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE hash_i4_heap (
|
CREATE TABLE hash_i4_heap (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user