postgresql/src
Tom Lane d0378c8a8c Fix array slicing of int2vector and oidvector values.
The previous coding labeled expressions such as pg_index.indkey[1:3] as
being of int2vector type; which is not right because the subscript bounds
of such a result don't, in general, satisfy the restrictions of int2vector.
To fix, implicitly promote the result of slicing int2vector to int2[],
or oidvector to oid[].  This is similar to what we've done with domains
over arrays, which is a good analogy because these types are very much
like restricted domains of the corresponding regular-array types.

A side-effect is that we now also forbid array-element updates on such
columns, eg while "update pg_index set indkey[4] = 42" would have worked
before if you were superuser (and corrupted your catalogs irretrievably,
no doubt) it's now disallowed.  This seems like a good thing since, again,
some choices of subscripting would've led to results not satisfying the
restrictions of int2vector.  The case of an array-slice update was
rejected before, though with a different error message than you get now.
We could make these cases work in future if we added a cast from int2[]
to int2vector (with a cast function checking the subscript restrictions)
but it seems unlikely that there's any value in that.

Per report from Ronan Dunklau.  Back-patch to all supported branches
because of the crash risks involved.
2013-11-23 20:04:13 -05:00
..
backend Fix array slicing of int2vector and oidvector values. 2013-11-23 20:04:13 -05:00
bin Translation updates 2013-10-07 16:10:44 -04:00
include Fix array slicing of int2vector and oidvector values. 2013-11-23 20:04:13 -05:00
interfaces Changed test case slightly so it doesn't have an unused typedef. 2013-11-03 15:41:57 +01:00
makefiles Make pgxs build executables with the right suffix. 2013-01-19 14:54:29 -05:00
pl Eliminate memory leaks in plperl's spi_prepare() function. 2013-03-01 21:34:40 -05:00
port Ensure _dosmaperr() actually sets errno correctly. 2013-11-23 18:25:00 -05:00
template Tweak configure to attempt to add -qnoansialias to CFLAGS whenever running 2009-02-11 20:02:40 +00:00
test Flatten join alias Vars before pulling up targetlist items from a subquery. 2013-11-22 14:37:38 -05:00
timezone Fix some odd behaviors when using a SQL-style simple GMT offset timezone. 2013-11-01 12:13:38 -04:00
tools Properly zero-pad the day-of-year part of the win32 build number 2013-01-31 15:09:01 +01:00
tutorial Remove copyright mention of Andrew Yu, per author's permission. 2010-02-02 18:52:06 +00:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:08 +02:00
bcc32.mak Remove old-style win32 client-only visual c++ build infrastructure for everything except 2007-03-05 14:18:38 +00:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Add the possibility to specify an explicit validator function for foreign-data 2009-02-24 10:06:36 +00:00
Makefile.global.in Back-patch creation of tar.bz2 tarball during "make dist". 2011-07-03 16:40:28 -04:00
Makefile.shlib Fix assorted issues with build and install paths containing spaces. 2011-06-14 16:03:20 -04:00
nls-global.mk Do not msgmerge against /dev/null; merge against the pot file itself 2009-01-20 09:58:50 +00:00
win32.mak Update supported standalone VC++ version to 7.1+ only, and fix 2007-08-03 10:47:11 +00:00