postgresql/src
Tom Lane c4d3cd3dc8 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:00 -05:00
..
backend Fix array slicing of int2vector and oidvector values. 2013-11-23 20:04:00 -05:00
bin Fix pg_isready to handle -d option properly. 2013-11-21 21:54:19 +09:00
common pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
include Fix array slicing of int2vector and oidvector values. 2013-11-23 20:04:00 -05:00
interfaces Changed test case slightly so it doesn't have an unused typedef. 2013-11-03 15:39:55 +01:00
makefiles Revert "Backpatch pgxs vpath build and installation fixes." 2013-10-07 22:32:04 -04:00
pl Translation updates 2013-10-07 16:27:04 -04:00
port Ensure _dosmaperr() actually sets errno correctly. 2013-11-23 18:24:42 -05:00
template Remove _FORTIFY_SOURCE 2012-10-10 21:42:38 -04:00
test Flatten join alias Vars before pulling up targetlist items from a subquery. 2013-11-22 14:37:25 -05:00
timezone Fix some odd behaviors when using a SQL-style simple GMT offset timezone. 2013-11-01 12:13:23 -04:00
tools Minor spelling fixes 2013-06-01 10:18:59 -04:00
tutorial Modernize string literal syntax in tutorial example. 2013-01-19 17:20:32 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04: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 Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Revert "Backpatch pgxs vpath build and installation fixes." 2013-10-07 22:32:04 -04:00
Makefile.shlib Add pkg-config files for libpq and ecpg libraries 2013-03-31 16:58:40 -04:00
nls-global.mk NLS: Use msgmerge --previous option 2012-12-13 23:12:12 -05:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00