Commit Graph

1845 Commits

Author SHA1 Message Date
Tom Lane fdf2dbda3f Fix assorted corner-case bugs in contrib/intarray.
The array containment operators now behave per mathematical expectation
for empty arrays (ie, an empty array is contained in anything).
Both these operators and the query_int operators now work as expected in
GiST and GIN index searches, rather than having corner cases where the
index searches gave different answers.

Also, fix unexpected failures where the operators would claim that an array
contained nulls, when in fact there was no longer any null present (similar
to bug #5784).  The restriction to not have nulls is still there, as
removing it would take a lot of added code complexity and probably slow
things down significantly.

Also, remove the arbitrary restriction to 1-D arrays; unlike the other
restriction, this was buying us nothing performance-wise.

Assorted cosmetic improvements and marginal performance improvements, too.
2011-01-09 00:39:21 -05:00
Bruce Momjian 002c105a07 In pg_upgrade, remove functions that did sequential array scans looking
up relations, but rather order old/new relations and use the same array
index value for both.  This should speed up pg_upgrade for databases
with many relations.
2011-01-08 13:44:44 -05:00
Bruce Momjian ebaf648ad2 In pg_upgrade, clarify use of install_db_support_functions(). 2011-01-08 09:11:48 -05:00
Bruce Momjian a60b32b3dc In pg_upgrade, remove unnecessary separate handling of toast tables now
that we restore by oid;  they can be handled like regular tables when
creating the file mapping structure.
2011-01-08 08:01:52 -05:00
Tom Lane 69c26c57cf Update GIN support function definitions for contrib/intarray.
The underlying C code still needs work, but this at least gets its
current regression test passing again.
2011-01-07 23:35:48 -05:00
Bruce Momjian 133641a48e Document why pg_upgrade preserves pg_auth.oid (because they are stored
in pg_largeobject_metadata).
2011-01-07 23:02:03 -05:00
Bruce Momjian 2f657e4d72 More pg_upgrade relfilenode C comments added. 2011-01-07 22:57:30 -05:00
Bruce Momjian 3095643d37 Simplify pg_upgrade C comment about what is preserved. 2011-01-07 22:46:41 -05:00
Bruce Momjian f75383e6e8 In pg_upgrade, track only one copy of namespace/relname in FileNameMap
because the old and new values are identical.
2011-01-07 22:36:51 -05:00
Bruce Momjian 519c008a96 Fix C indenting in pg_upgrade function. 2011-01-07 22:01:44 -05:00
Bruce Momjian d8d3d2a4f3 Fix pg_upgrade of large object permissions by preserving pg_auth.oid,
which is stored in pg_largeobject_metadata.

No backpatch to 9.0 because you can't migrate from 9.0 to 9.0 with the
same catversion (because of tablespace conflict), and a pre-9.0
migration to 9.0 has not large object permissions to migrate.
2011-01-07 21:59:29 -05:00
Bruce Momjian 2896c87ce4 Force pg_upgrade's to preserve pg_class.oid, not pg_class.relfilenode.
Toast tables have identical pg_class.oid and pg_class.relfilenode, but
for clarity it is good to preserve the pg_class.oid.

Update comments regarding what is preserved, and do some
variable/function renaming for clarity.
2011-01-07 21:26:13 -05:00
Tom Lane 541fc3d4df Ooops, forgot to fix contrib/tsearch2's references to GIN support funcs. 2011-01-07 21:10:48 -05:00
Tom Lane 73912e7fbd Fix GIN to support null keys, empty and null items, and full index scans.
Per my recent proposal(s).  Null key datums can now be returned by
extractValue and extractQuery functions, and will be stored in the index.
Also, placeholder entries are made for indexable items that are NULL or
contain no keys according to extractValue.  This means that the index is
now always complete, having at least one entry for every indexed heap TID,
and so we can get rid of the prohibition on full-index scans.  A full-index
scan is implemented much the same way as partial-match scans were already:
we build a bitmap representing all the TIDs found in the index, and then
drive the results off that.

Also, introduce a concept of a "search mode" that can be requested by
extractQuery when the operator requires matching to empty items (this is
just as cheap as matching to a single key) or requires a full index scan
(which is not so cheap, but it sure beats failing or giving wrong answers).
The behavior remains backward compatible for opclasses that don't return
any null keys or request a non-default search mode.

Using these features, we can now make the GIN index opclass for anyarray
behave in a way that matches the actual anyarray operators for &&, <@, @>,
and = ... which it failed to do before in assorted corner cases.

This commit fixes the core GIN code and ginarrayprocs.c, updates the
documentation, and adds some simple regression test cases for the new
behaviors using the array operators.  The tsearch and contrib GIN opclass
support functions still need to be looked over and probably fixed.

Another thing I intend to fix separately is that this is pretty inefficient
for cases where more than one scan condition needs a full-index search:
we'll run duplicate GinScanEntrys, each one of which builds a large bitmap.
There is some existing logic to merge duplicate GinScanEntrys but it needs
refactoring to make it work for entries belonging to different scan keys.

Note that most of gin.h has been split out into a new file gin_private.h,
so that gin.h doesn't export anything that's not supposed to be used by GIN
opclasses or the rest of the backend.  I did quite a bit of other code
beautification work as well, mostly fixing comments and choosing more
appropriate names for things.
2011-01-07 19:16:24 -05:00
Bruce Momjian 46d28820b6 Improve C comments about backend variables set by pg_upgrade_support
functions.
2011-01-06 22:45:36 -05:00
Bruce Momjian 56a9adcb96 Rename pg_upgrade variables, for clarity. 2011-01-05 20:14:59 -05:00
Bruce Momjian e66e43988a Update pg_upgrade C comments. 2011-01-05 14:09:01 -05:00
Bruce Momjian a45beaac64 Fix for recent pg_upgrade commit to fix large objects relfilenode
handling.  (metadata user ids still an open issue).
2011-01-05 13:52:44 -05:00
Bruce Momjian b1f2a94fa2 In pg_upgrade, adjust transfer_relfile()'s parameters to be more logical. 2011-01-05 12:07:45 -05:00
Bruce Momjian 5cff5b5779 Clarify pg_upgrade's creation of the map file structure. Also clean
up pg_dump's calling of pg_upgrade_support functions.
2011-01-05 11:37:08 -05:00
Bruce Momjian 3302334b48 In pg_upgrade, copy pg_largeobject_metadata and its index for 9.0+
servers because, like pg_largeobject, it is a system table whose
contents are not dumped by pg_dump --schema-only.
2011-01-04 23:35:49 -05:00
Bruce Momjian 0857a84498 In pg_upgrade, fix backward logging display of link operations. 2011-01-04 21:33:36 -05:00
Bruce Momjian 25cc7424e3 Simplify functions and parameters used by pg_upgrade. 2011-01-04 19:11:37 -05:00
Robert Haas 0d692a0dc9 Basic foreign table support.
Foreign tables are a core component of SQL/MED.  This commit does
not provide a working SQL/MED infrastructure, because foreign tables
cannot yet be queried.  Support for foreign table scans will need to
be added in a future patch.  However, this patch creates the necessary
system catalog structure, syntax support, and support for ancillary
operations such as COMMENT and SECURITY LABEL.

Shigeru Hanada, heavily revised by Robert Haas
2011-01-01 23:48:11 -05:00
Bruce Momjian 5d950e3b0c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
Bruce Momjian 67c9e4442f Furter pg_upgrade optimizations to reduce function call argument count. 2011-01-01 12:28:48 -05:00
Bruce Momjian 6e6bee987f In pg_upgrade, remove use of whichCluster, and just pass old/new cluster
pointers, which simplifies the code.  This was not possible in 9.0 because
everything was in a single nested struct, but is possible now.

Per suggestion from Tom.
2011-01-01 12:06:36 -05:00
Bruce Momjian f82b3e58f8 In pg_upgrade, rename "CLUSTERNAME" to "CLUSTER_NAME". 2010-12-31 20:42:29 -05:00
Tom Lane 88c803457a Improve pg_upgrade's checks for required executables.
Don't insist on pg_dumpall and psql being present in the old cluster,
since they are not needed.  Do insist on pg_resetxlog being present
(in both old and new), since we need it.  Also check for pg_config,
but only in the new cluster.  Remove the useless attempt to call
pg_config in the old cluster; we don't need to know the old value of
--pkglibdir.  (In the case of a stripped-down migration installation
there might be nothing there to look at anyway, so any future change
that might reintroduce that need would have to be considered carefully.)

Per my attempts to build a minimal previous-version installation to support
pg_upgrade.
2010-12-29 13:43:53 -05:00
Bruce Momjian c0577c92a8 Mark unaccent functions as STABLE, rather than defaulting to VOLATILE. 2010-12-27 15:34:42 -05:00
Robert Haas 32ba2b5160 Use memcmp() rather than strncmp() when shorter string length is known.
It appears that this will be faster for all but the shortest strings;
at least one some platforms, memcmp() can use word-at-a-time comparisons.

Noah Misch, somewhat pared down.
2010-12-21 22:11:40 -05:00
Tom Lane abc1026269 Fix erroneous parsing of tsquery input "... & !(subexpression) | ..."
After parsing a parenthesized subexpression, we must pop all pending
ANDs and NOTs off the stack, just like the case for a simple operand.
Per bug #5793.

Also fix clones of this routine in contrib/intarray and contrib/ltree,
where input of types query_int and ltxtquery had the same problem.

Back-patch to all supported versions.
2010-12-19 12:48:34 -05:00
Tom Lane 2a6ebe70fb Fix contrib/seg's GiST picksplit method.
This patch replaces Guttman's generalized split method with a simple
sort-by-center-points algorithm.  Since the data is only one-dimensional
we don't really need the slow and none-too-stable Guttman method.

This is in part a bug fix, since seg has the same size_alpha versus
size_beta typo that was recently fixed in contrib/cube.  It seems
prudent to apply this rather aggressive fix only in HEAD, though.
Back branches will just get the typo fix.

Alexander Korotkov, reviewed by Yeb Havinga
2010-12-15 21:24:47 -05:00
Bruce Momjian 16b5e08dec Use "upgrade" in preference over "migrate" in pg_upgrade messages and
documentation.  (Many were left over from the old pg_migrator naming.)
2010-12-15 07:11:31 -05:00
Tom Lane 3864afa1d1 Clean up some copied-and-pasted code in pg_upgrade.
1. Don't reimplement S_ISDIR() and S_ISREG() badly.
2. Don't reimplement access() badly.

This code appears to have been copied from ancient versions of the
corresponding backend routines, and not patched to incorporate subsequent
fixes (see my commits of 2008-03-31 and 2010-01-14 respectively).
It might be a good idea to change it to just *call* those routines,
but for now I'll just transpose these fixes over.
2010-12-11 14:17:46 -05:00
Tom Lane b525bf771e Add KNNGIST support to contrib/pg_trgm.
Teodor Sigaev, with some revision by Tom
2010-12-04 00:16:21 -05:00
Robert Haas fab7fdb988 Fix typo.
Fujii Masao
2010-11-28 20:46:11 -05:00
Robert Haas fe7a32fc87 New contrib module, auth_delay.
KaiGai Kohei, with a few changes by me.
2010-11-27 07:22:25 -05:00
Tom Lane 4a2516a7f9 Fix significant memory leak in contrib/xml2 functions.
Most of the functions that execute XPath queries leaked the data structures
created by libxml2.  This memory would not be recovered until end of
session, so it mounts up pretty quickly in any serious use of the feature.
Per report from Pavel Stehule, though this isn't his patch.

Back-patch to all supported branches.
2010-11-26 15:21:53 -05:00
Itagaki Takahiro d3c1265443 Don't raise "identifier will be truncated" messages in dblink
except creating new connections.
2010-11-25 19:40:58 +09:00
Peter Eisentraut fc946c39ae Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
Robert Haas 4343c0e546 Expose quote_literal_cstr() from core.
This eliminates the need for inefficient implementions of this
functionality in both contrib/dblink and contrib/tablefunc, so remove
them.  The upcoming patch implementing an in-core format() function
will also require this functionality.

In passing, add some regression tests.
2010-11-20 10:04:48 -05:00
Robert Haas 4fa0a23c70 Fix bug in cube picksplit algorithm.
Alexander Korotkov
2010-11-14 21:27:34 -05:00
Robert Haas 5aa446c961 Cleanup various comparisons with the constant "true".
Itagaki Takahiro, with slight modifications.
2010-11-14 21:03:48 -05:00
Robert Haas 11e482c350 Move copydir() prototype into its own header file.
Having this in src/include/port.h makes no sense, now that copydir.c lives
in src/backend/strorage rather than src/port.  Along the way, remove an
obsolete comment from contrib/pg_upgrade that makes reference to the old
location.
2010-11-12 16:39:53 -05:00
Peter Eisentraut 19e231bbda Improved parallel make support
Replace for loops in makefiles with proper dependencies.  Parallel
make can now span across directories.  Also, make -k and make -q work
properly.

GNU make 3.80 or newer is now required.
2010-11-12 22:15:16 +02:00
Tom Lane 5e8b7b0b73 Allow moddatetime's target column to be of type timestamptz.
Dirk Heinrichs
2010-11-04 16:34:47 -04:00
Tom Lane 71baff1786 Fix buffer overrun in pg_upgrade.
Problem reported, and cause identified, by Hernan Gonzalez.
2010-11-02 17:31:41 -04:00
Peter Eisentraut a87d212636 Add missing newlines at end of files 2010-10-26 20:11:43 +03:00
Itagaki Takahiro 07ca728f69 Add .gitignore for contrib/uuid-ossp. 2010-10-26 12:25:34 +09:00