postgresql/src/backend
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
..
access Fix race condition in GIN posting tree page deletion. 2013-11-08 22:23:19 +02:00
bootstrap Avoid changing an index's indcheckxmin horizon during REINDEX. 2011-04-19 18:51:08 -04:00
catalog Prevent creating window functions with default arguments. 2013-11-06 13:32:36 -05:00
commands Fix some odd behaviors when using a SQL-style simple GMT offset timezone. 2013-11-01 12:13:38 -04:00
executor Add defenses against integer overflow in dynahash numbuckets calculations. 2012-12-11 22:09:34 -05:00
foreign deflist_to_tuplestore dumped core on an option with no value. 2011-09-13 11:37:03 -04:00
lib Update copyright for 2009. 2009-01-01 17:24:05 +00:00
libpq Produce a more useful error message for over-length Unix socket paths. 2012-11-29 19:57:33 -05:00
main Update copyright for 2009. 2009-01-01 17:24:05 +00:00
nodes Fix incorrect loop counts in tidbitmap.c. 2013-11-15 18:34:39 -05:00
optimizer Flatten join alias Vars before pulling up targetlist items from a subquery. 2013-11-22 14:37:38 -05:00
parser Fix array slicing of int2vector and oidvector values. 2013-11-23 20:04:13 -05:00
po Translation updates 2013-10-07 16:10:44 -04:00
port Fix Windows implementation of PGSemaphoreLock. 2012-05-10 13:36:28 -04:00
postmaster Reset OpenSSL randomness state in each postmaster child process. 2013-03-27 18:50:38 -04:00
regex Fix regex match failures for backrefs combined with non-greedy quantifiers. 2013-07-18 21:23:04 -04:00
rewrite Change post-rewriter representation of dropped columns in joinaliasvars. 2013-07-23 16:23:19 -04:00
snowball Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:08 +02:00
storage Ensure all files created for a single BufFile have the same resource owner. 2013-11-01 16:10:08 -04:00
tcop Ignore interrupts during quickdie(). 2013-09-11 20:17:52 -04:00
tsearch Fix bug in to_tsquery(). 2012-05-16 14:39:52 +03:00
utils Avoid potential buffer overflow crash 2013-11-23 07:31:53 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:08 +02:00
common.mk Code coverage testing with gcov. Documentation is in the regression test 2008-09-05 12:11:18 +00:00
Makefile Fix PGXS support for building loadable modules on AIX. 2012-10-09 21:04:26 -04:00
nls.mk Translation updates 2013-02-03 23:53:08 -05:00