Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc81c71d

Browse files
committed
In plpgsql, don't try to convert int2vector or oidvector to expanded array.
These types are storage-compatible with real arrays, but they don't supporttoasting, so of course they can't support expansion either.Per bug #14289 from Michael Overmeyer. Back-patch to 9.5 where expandedarrays were introduced.Report: <20160818174414.1529.37913@wrigleys.postgresql.org>
1 parent191d457 commitc81c71d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

‎src/include/utils/array.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
* The OIDVECTOR and INT2VECTOR datatypes are storage-compatible with
3838
* generic arrays, but they support only one-dimensional arrays with no
39-
* nulls (and no null bitmap).
39+
* nulls (and no null bitmap). They don't support being toasted, either.
4040
*
4141
* There are also some "fixed-length array" datatypes, such as NAME and
4242
* POINT. These are simply a sequence of a fixed number of items each

‎src/pl/plpgsql/src/pl_comp.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,14 +2192,19 @@ build_datatype(HeapTuple typeTup, int32 typmod, Oid collation)
21922192
/* NB: this is only used to decide whether to apply expand_array */
21932193
if (typeStruct->typtype==TYPTYPE_BASE)
21942194
{
2195-
/* this test should match what get_element_type() checks */
2195+
/*
2196+
* This test should include what get_element_type() checks. We also
2197+
* disallow non-toastable array types (i.e. oidvector and int2vector).
2198+
*/
21962199
typ->typisarray= (typeStruct->typlen==-1&&
2197-
OidIsValid(typeStruct->typelem));
2200+
OidIsValid(typeStruct->typelem)&&
2201+
typeStruct->typstorage!='p');
21982202
}
21992203
elseif (typeStruct->typtype==TYPTYPE_DOMAIN)
22002204
{
22012205
/* we can short-circuit looking up base types if it's not varlena */
22022206
typ->typisarray= (typeStruct->typlen==-1&&
2207+
typeStruct->typstorage!='p'&&
22032208
OidIsValid(get_base_element_type(typeStruct->typbasetype)));
22042209
}
22052210
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp