summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-03-29 00:17:27 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-03-29 00:17:27 +0000
commit70c9763d4815ac847f0f7694f43eb6a59a236868 (patch)
tree7d8aa05f668f1ef7809ff521b6c1e12d31125fd7 /src/test
parent119191609c507528b20d74c59be69f2129127575 (diff)
downloadpostgresql-70c9763d4815ac847f0f7694f43eb6a59a236868.tar.gz
Convert oidvector and int2vector into variable-length arrays. This
change saves a great deal of space in pg_proc and its primary index, and it eliminates the former requirement that INDEX_MAX_KEYS and FUNC_MAX_ARGS have the same value. INDEX_MAX_KEYS is still embedded in the on-disk representation (because it affects index tuple header size), but FUNC_MAX_ARGS is not. I believe it would now be possible to increase FUNC_MAX_ARGS at little cost, but haven't experimented yet. There are still a lot of vestigial references to FUNC_MAX_ARGS, which I will clean up in a separate pass. However, getting rid of it altogether would require changing the FunctionCallInfoData struct, and I'm not sure I want to buy into that.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/opr_sanity.out20
-rw-r--r--src/test/regress/expected/type_sanity.out26
-rw-r--r--src/test/regress/sql/opr_sanity.sql20
-rw-r--r--src/test/regress/sql/type_sanity.sql10
4 files changed, 34 insertions, 42 deletions
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out
index 937f179439..8740b0e938 100644
--- a/src/test/regress/expected/opr_sanity.out
+++ b/src/test/regress/expected/opr_sanity.out
@@ -33,23 +33,13 @@ create function physically_coercible(oid, oid) returns bool as
language sql;
-- **************** pg_proc ****************
-- Look for illegal values in pg_proc fields.
--- NOTE: in reality pronargs could be more than 10, but I'm too lazy to put
--- a larger number of proargtypes check clauses in here. If we ever have
--- more-than-10-arg functions in the standard catalogs, extend this query.
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE p1.prolang = 0 OR p1.prorettype = 0 OR
- p1.pronargs < 0 OR p1.pronargs > 10 OR
- (p1.proargtypes[0] = 0 AND p1.pronargs > 0) OR
- (p1.proargtypes[1] = 0 AND p1.pronargs > 1) OR
- (p1.proargtypes[2] = 0 AND p1.pronargs > 2) OR
- (p1.proargtypes[3] = 0 AND p1.pronargs > 3) OR
- (p1.proargtypes[4] = 0 AND p1.pronargs > 4) OR
- (p1.proargtypes[5] = 0 AND p1.pronargs > 5) OR
- (p1.proargtypes[6] = 0 AND p1.pronargs > 6) OR
- (p1.proargtypes[7] = 0 AND p1.pronargs > 7) OR
- (p1.proargtypes[8] = 0 AND p1.pronargs > 8) OR
- (p1.proargtypes[9] = 0 AND p1.pronargs > 9);
+ p1.pronargs < 0 OR
+ array_lower(p1.proargtypes, 1) != 0 OR
+ array_upper(p1.proargtypes, 1) != p1.pronargs-1 OR
+ 0::oid = ANY (p1.proargtypes);
oid | proname
-----+---------
(0 rows)
@@ -218,7 +208,7 @@ WHERE p1.oid != p2.oid AND
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE p1.prorettype = 'internal'::regtype AND NOT
- ('(' || oidvectortypes(p1.proargtypes) || ')') ~ '[^a-z0-9_]internal[^a-z0-9_]';
+ 'internal'::regtype = ANY (p1.proargtypes);
oid | proname
------+-------------
2304 | internal_in
diff --git a/src/test/regress/expected/type_sanity.out b/src/test/regress/expected/type_sanity.out
index 58b8dc6dd1..881220bf28 100644
--- a/src/test/regress/expected/type_sanity.out
+++ b/src/test/regress/expected/type_sanity.out
@@ -106,14 +106,18 @@ ORDER BY 1;
(1 row)
-- Varlena array types will point to array_in
+-- Exception as of 8.1: int2vector and oidvector have their own I/O routines
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND
(p1.typelem != 0 AND p1.typlen < 0) AND NOT
- (p2.oid = 'array_in'::regproc);
- oid | typname | oid | proname
------+---------+-----+---------
-(0 rows)
+ (p2.oid = 'array_in'::regproc)
+ORDER BY 1;
+ oid | typname | oid | proname
+-----+------------+-----+--------------
+ 22 | int2vector | 40 | int2vectorin
+ 30 | oidvector | 54 | oidvectorin
+(2 rows)
-- Check for bogus typoutput routines
-- As of 8.0, this check finds refcursor, which is borrowing
@@ -165,14 +169,18 @@ ORDER BY 1;
(1 row)
-- Varlena array types will point to array_recv
+-- Exception as of 8.1: int2vector and oidvector have their own I/O routines
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND
(p1.typelem != 0 AND p1.typlen < 0) AND NOT
- (p2.oid = 'array_recv'::regproc);
- oid | typname | oid | proname
------+---------+-----+---------
-(0 rows)
+ (p2.oid = 'array_recv'::regproc)
+ORDER BY 1;
+ oid | typname | oid | proname
+-----+------------+------+----------------
+ 22 | int2vector | 2410 | int2vectorrecv
+ 30 | oidvector | 2420 | oidvectorrecv
+(2 rows)
-- Check for bogus typsend routines
-- As of 7.4, this check finds refcursor, which is borrowing
@@ -203,7 +211,7 @@ WHERE p1.typsend = p2.oid AND p1.typtype in ('b', 'p') AND NOT
-- Look for illegal values in pg_class fields
SELECT p1.oid, p1.relname
FROM pg_class as p1
-WHERE p1.relkind NOT IN ('r', 'i', 's', 'S', 't', 'v');
+WHERE p1.relkind NOT IN ('r', 'i', 's', 'S', 'c', 't', 'v');
oid | relname
-----+---------
(0 rows)
diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql
index 567eb89e6b..84e9b9f738 100644
--- a/src/test/regress/sql/opr_sanity.sql
+++ b/src/test/regress/sql/opr_sanity.sql
@@ -39,24 +39,14 @@ language sql;
-- **************** pg_proc ****************
-- Look for illegal values in pg_proc fields.
--- NOTE: in reality pronargs could be more than 10, but I'm too lazy to put
--- a larger number of proargtypes check clauses in here. If we ever have
--- more-than-10-arg functions in the standard catalogs, extend this query.
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE p1.prolang = 0 OR p1.prorettype = 0 OR
- p1.pronargs < 0 OR p1.pronargs > 10 OR
- (p1.proargtypes[0] = 0 AND p1.pronargs > 0) OR
- (p1.proargtypes[1] = 0 AND p1.pronargs > 1) OR
- (p1.proargtypes[2] = 0 AND p1.pronargs > 2) OR
- (p1.proargtypes[3] = 0 AND p1.pronargs > 3) OR
- (p1.proargtypes[4] = 0 AND p1.pronargs > 4) OR
- (p1.proargtypes[5] = 0 AND p1.pronargs > 5) OR
- (p1.proargtypes[6] = 0 AND p1.pronargs > 6) OR
- (p1.proargtypes[7] = 0 AND p1.pronargs > 7) OR
- (p1.proargtypes[8] = 0 AND p1.pronargs > 8) OR
- (p1.proargtypes[9] = 0 AND p1.pronargs > 9);
+ p1.pronargs < 0 OR
+ array_lower(p1.proargtypes, 1) != 0 OR
+ array_upper(p1.proargtypes, 1) != p1.pronargs-1 OR
+ 0::oid = ANY (p1.proargtypes);
-- Look for conflicting proc definitions (same names and input datatypes).
-- (This test should be dead code now that we have the unique index
@@ -179,7 +169,7 @@ WHERE p1.oid != p2.oid AND
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE p1.prorettype = 'internal'::regtype AND NOT
- ('(' || oidvectortypes(p1.proargtypes) || ')') ~ '[^a-z0-9_]internal[^a-z0-9_]';
+ 'internal'::regtype = ANY (p1.proargtypes);
-- **************** pg_cast ****************
diff --git a/src/test/regress/sql/type_sanity.sql b/src/test/regress/sql/type_sanity.sql
index 3e421127d1..81f83525dd 100644
--- a/src/test/regress/sql/type_sanity.sql
+++ b/src/test/regress/sql/type_sanity.sql
@@ -88,11 +88,13 @@ WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND NOT
ORDER BY 1;
-- Varlena array types will point to array_in
+-- Exception as of 8.1: int2vector and oidvector have their own I/O routines
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND
(p1.typelem != 0 AND p1.typlen < 0) AND NOT
- (p2.oid = 'array_in'::regproc);
+ (p2.oid = 'array_in'::regproc)
+ORDER BY 1;
-- Check for bogus typoutput routines
@@ -132,11 +134,13 @@ WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND NOT
ORDER BY 1;
-- Varlena array types will point to array_recv
+-- Exception as of 8.1: int2vector and oidvector have their own I/O routines
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND
(p1.typelem != 0 AND p1.typlen < 0) AND NOT
- (p2.oid = 'array_recv'::regproc);
+ (p2.oid = 'array_recv'::regproc)
+ORDER BY 1;
-- Check for bogus typsend routines
@@ -163,7 +167,7 @@ WHERE p1.typsend = p2.oid AND p1.typtype in ('b', 'p') AND NOT
SELECT p1.oid, p1.relname
FROM pg_class as p1
-WHERE p1.relkind NOT IN ('r', 'i', 's', 'S', 't', 'v');
+WHERE p1.relkind NOT IN ('r', 'i', 's', 'S', 'c', 't', 'v');
-- Indexes should have an access method, others not.