Commit Graph

1872 Commits

Author SHA1 Message Date
Tom Lane cd7d748d51 Repair multiple breakage in Windows-specific code for appending '.exe'. 2011-02-02 20:26:43 -05:00
Bruce Momjian 2b6e2dee78 Fix wrong verb in pg_upgrade text message, per Haas. 2011-02-02 16:53:12 -05:00
Bruce Momjian 9d220fc17e Simplify pg_upgrade checking of executable permissions. 2011-02-02 15:40:52 -05:00
Bruce Momjian 2bb87a61a8 Add pg_upgrade comment for why we can't use template1 inheritance for
the support functions.
2011-02-01 12:23:08 -05:00
Tom Lane 6e2f3ae884 Support LIKE and ILIKE index searches via contrib/pg_trgm indexes.
Unlike Btree-based LIKE optimization, this works for non-left-anchored
search patterns.  The effectiveness of the search depends on how many
trigrams can be extracted from the pattern.  (The worst case, with no
trigrams, degrades to a full-table scan, so this isn't a panacea.  But
it can be very useful.)

Alexander Korotkov, reviewed by Jan Urbanski
2011-01-31 21:34:49 -05:00
Bruce Momjian 6238473adb Fix pg_upgrade to create pg_authid restore functions in the 'postgres'
database, not in the os-user database, per report from Magnus.
2011-01-31 20:16:15 -05:00
Tom Lane 7ccb6dc2d3 Prevent buffer overrun while parsing an integer in a "query_int" value.
contrib/intarray's gettoken() uses a fixed-size buffer to collect an
integer's digits, and did not guard against overrunning the buffer.
This is at least a backend crash risk, and in principle might allow
arbitrary code execution.  The code didn't check for overflow of the
integer value either, which while not presenting a crash risk was still
bad.

Thanks to Apple Inc's security team for reporting this issue and supplying
the fix.

Security: CVE-2010-4015
2011-01-27 17:42:39 -05:00
Bruce Momjian 4fec63f94e Per Peter E, use 'kB' for kilobyte, not 'K'. 2011-01-26 16:21:19 -05:00
Bruce Momjian 00869024cb In pg_test_fsync, use K(1024) rather than k(1000) for write size units. 2011-01-26 11:02:52 -05:00
Bruce Momjian 64bc872761 Adjust pg_test_fsync to always do XLOG_BLCKSZ-sized writes, rather than
always 8k writes, per suggestion from Tom.  Also adjust open_sync output
layout.
2011-01-25 22:18:24 -05:00
Bruce Momjian d7a714828f Use consistent spacing for PGAPPICON Makefile option. 2011-01-24 20:46:30 -05:00
Bruce Momjian 9dd7933937 Use XLOG_BLCKSZ in pg_test_fsync, rather than our own define, but verify
it is 8k as expected.
2011-01-24 20:07:05 -05:00
Bruce Momjian 9fc0192283 In test_open_sync(), writes kilobytes as intended, not by bytes. 2011-01-24 19:42:32 -05:00
Robert Haas 41611f16e9 PGXS support for contrib/hstore
Joey Adams
2011-01-23 23:07:55 -05:00
Robert Haas 194c8f713a First round of cleanup of sepgsql code and documentation.
Robert Haas, with a few suggestions from Thom Brown
2011-01-23 22:48:22 -05:00
Robert Haas 968bc6fac9 sepgsql, an SE-Linux integration for PostgreSQL
This is still pretty rough - among other things, the documentation
needs work, and the messages need a visit from the style police -
but this gets the basic framework in place.

KaiGai Kohei
2011-01-23 20:48:27 -05:00
Tom Lane 37eb2cd4ad More pg_test_fsync fixups.
Reduce #includes to minimum actually needed; in particular include
postgres_fe.h not postgres.h, so as to stop build failures on some
platforms.

Use get_progname() instead of hardwired program name; improve error
checking for command line syntax; bring error messages into line with
style guidelines; include strerror result in die() cases.
2011-01-22 15:01:26 -05:00
Tom Lane 3ae28ce8c4 Suppress unused-variables warning when OPEN_SYNC_FLAG isn't defined.
Per buildfarm.
2011-01-22 12:26:44 -05:00
Tom Lane cb38ab6d3b More pg_test_fsync cleanup.
Un-break Windows build (I hope) by making the HAVE_FSYNC_WRITETHROUGH
code match the backend.  Fix incorrect program help message.  static-ize
all functions.
2011-01-21 19:44:53 -05:00
Tom Lane bc616703e8 Clean up pg_test_fsync commit.
Actually rename the program, rather than just claiming we did.  Hook it
into the build system.  Get rid of useless dependency on libpq.  Clean up
#include list and messy whitespace.
2011-01-21 19:27:25 -05:00
Bruce Momjian b35bfcae93 Update C banner on new pg_test_fsync file. 2011-01-21 12:49:04 -05:00
Bruce Momjian 606a3d54fc Move test_fsync to /contrib. 2011-01-21 12:47:54 -05:00
Bruce Momjian 0a5f119931 A toast relid field are no longer needed in pg_upgrade's rel arrays, so
remove them.  Also other renaming.
2011-01-10 11:46:02 -05:00
Tom Lane be0c3ea2d3 Update contrib/pg_trgm for new GIN extractQuery API.
No actual change in functionality ... just get rid of uselessly complex
code to pass the number of keys via extra_data.
2011-01-09 18:04:20 -05:00
Tom Lane ba398969cd Update contrib/hstore for new GIN extractQuery API.
In particular, make hstore @> '' succeed for all hstores, likewise
hstore ?& '{}'.  Previously the results were inconsistent and could
depend on whether you were using a GiST index, GIN index, or seqscan.
2011-01-09 16:43:56 -05:00
Tom Lane 327b257682 Improve comment. 2011-01-09 15:25:17 -05:00
Tom Lane 304845075c Use array_contains_nulls instead of ARR_HASNULL on user-supplied arrays.
This applies the fix for bug #5784 to remaining places where we wish
to reject nulls in user-supplied arrays.  In all these places, there's
no reason not to allow a null bitmap to be present, so long as none of
the current elements are actually null.

I did not change some other places where we are looking at system catalog
entries or aggregate transition values, as the presence of a null bitmap
in such an array would be suspicious.
2011-01-09 13:09:07 -05:00
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