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

Commita8fc195

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 parenta0833b9 commita8fc195

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
@@ -2204,14 +2204,19 @@ build_datatype(HeapTuple typeTup, int32 typmod, Oid collation)
22042204
/* NB: this is only used to decide whether to apply expand_array */
22052205
if (typeStruct->typtype==TYPTYPE_BASE)
22062206
{
2207-
/* this test should match what get_element_type() checks */
2207+
/*
2208+
* This test should include what get_element_type() checks. We also
2209+
* disallow non-toastable array types (i.e. oidvector and int2vector).
2210+
*/
22082211
typ->typisarray= (typeStruct->typlen==-1&&
2209-
OidIsValid(typeStruct->typelem));
2212+
OidIsValid(typeStruct->typelem)&&
2213+
typeStruct->typstorage!='p');
22102214
}
22112215
elseif (typeStruct->typtype==TYPTYPE_DOMAIN)
22122216
{
22132217
/* we can short-circuit looking up base types if it's not varlena */
22142218
typ->typisarray= (typeStruct->typlen==-1&&
2219+
typeStruct->typstorage!='p'&&
22152220
OidIsValid(get_base_element_type(typeStruct->typbasetype)));
22162221
}
22172222
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp