users/rhaas/postgres.git
10 years agoUpdate buffer README; get rid of buf_table.c. chash2014
Robert Haas [Tue, 27 Jan 2015 03:19:02 +0000 (03:19 +0000)]
Update buffer README; get rid of buf_table.c.

10 years agoOops.
Robert Haas [Tue, 14 Oct 2014 11:52:43 +0000 (11:52 +0000)]
Oops.

10 years agoOops.
Robert Haas [Mon, 13 Oct 2014 20:33:43 +0000 (20:33 +0000)]
Oops.

10 years agoUse chash for buftable stuff.
Robert Haas [Mon, 13 Oct 2014 20:26:45 +0000 (16:26 -0400)]
Use chash for buftable stuff.

10 years agoFix #includes.
Robert Haas [Mon, 13 Oct 2014 19:12:12 +0000 (15:12 -0400)]
Fix #includes.

10 years agoRearrange pointers so that the freelist pointers are as far from
Robert Haas [Thu, 30 Aug 2012 13:34:59 +0000 (13:34 +0000)]
Rearrange pointers so that the freelist pointers are as far from
each other as possible, to reduce contention.

10 years agoCode cleanup.
Robert Haas [Fri, 3 Aug 2012 16:59:24 +0000 (16:59 +0000)]
Code cleanup.

10 years agoReorganize fields to match comments.
Robert Haas [Fri, 3 Aug 2012 15:35:57 +0000 (15:35 +0000)]
Reorganize fields to match comments.

10 years agoRefactor garbage collection logic into a separate subroutine.
Robert Haas [Fri, 3 Aug 2012 12:15:11 +0000 (12:15 +0000)]
Refactor garbage collection logic into a separate subroutine.

10 years agoSet hazard pointers correctly instead of wrong. Duh.
Robert Haas [Fri, 3 Aug 2012 12:01:24 +0000 (12:01 +0000)]
Set hazard pointers correctly instead of wrong.  Duh.

10 years agoDe-obfuscate deletion code, maybe.
Robert Haas [Thu, 2 Aug 2012 18:50:32 +0000 (18:50 +0000)]
De-obfuscate deletion code, maybe.

10 years agoCode tightening.
Robert Haas [Thu, 2 Aug 2012 18:31:02 +0000 (18:31 +0000)]
Code tightening.

10 years agoAdd memory barrier in single-node-reclaim case. Improve comments.
Robert Haas [Thu, 2 Aug 2012 17:59:24 +0000 (17:59 +0000)]
Add memory barrier in single-node-reclaim case.  Improve comments.

10 years agoGet rid of CHashBucketCleanup; CHashBucketScan can do what we need.
Robert Haas [Thu, 2 Aug 2012 17:03:34 +0000 (17:03 +0000)]
Get rid of CHashBucketCleanup; CHashBucketScan can do what we need.

This might seem less efficient because we actually examine the hash codes
and node contents this way, and that's true, but on the upside we get to
stop the scan early sometimes.  Furthermore, benchmarking reveals that
cleanup scans are (thankfully) quite rare, even in highly concurrent
scenarios, so it doesn't seem worth expending extra code (with the
attendant risk of bugs) to optimize that path.

10 years agoComment fixes.
Robert Haas [Thu, 2 Aug 2012 16:23:31 +0000 (16:23 +0000)]
Comment fixes.

10 years agoTrack GC reclaims skipped in stats.
Robert Haas [Thu, 2 Aug 2012 15:45:46 +0000 (15:45 +0000)]
Track GC reclaims skipped in stats.

10 years agoWonky hack to print stats on every backend exit.
Robert Haas [Thu, 2 Aug 2012 14:28:51 +0000 (14:28 +0000)]
Wonky hack to print stats on every backend exit.

10 years agoRewrite statistics system.
Robert Haas [Thu, 2 Aug 2012 14:01:20 +0000 (14:01 +0000)]
Rewrite statistics system.

10 years agoMinor optimization of allocator.
Robert Haas [Wed, 1 Aug 2012 23:48:41 +0000 (23:48 +0000)]
Minor optimization of allocator.

10 years agoIf we fail to allocate from a non-empty freelist, retry same list.
Robert Haas [Wed, 1 Aug 2012 20:37:28 +0000 (20:37 +0000)]
If we fail to allocate from a non-empty freelist, retry same list.

10 years agoAdd some missing stats counter bumps.
Robert Haas [Wed, 1 Aug 2012 20:24:26 +0000 (20:24 +0000)]
Add some missing stats counter bumps.

10 years agoIncrease maximum number of freelists from 16 to 64, per testing.
Robert Haas [Wed, 1 Aug 2012 17:43:28 +0000 (17:43 +0000)]
Increase maximum number of freelists from 16 to 64, per testing.

10 years agoBug fixes.
Robert Haas [Wed, 1 Aug 2012 17:37:42 +0000 (17:37 +0000)]
Bug fixes.

10 years agoImplement concurrent and collision tests for dynahash.
Robert Haas [Wed, 1 Aug 2012 17:06:51 +0000 (17:06 +0000)]
Implement concurrent and collision tests for dynahash.

10 years agoFix ABA problem with inserts.
Robert Haas [Wed, 1 Aug 2012 16:51:09 +0000 (16:51 +0000)]
Fix ABA problem with inserts.

10 years agoGet rid of chash_bucket hack in favor of using formal hazard pointers.
Robert Haas [Wed, 1 Aug 2012 16:13:36 +0000 (16:13 +0000)]
Get rid of chash_bucket hack in favor of using formal hazard pointers.

10 years agoCode cleanup.
Robert Haas [Wed, 1 Aug 2012 15:56:30 +0000 (15:56 +0000)]
Code cleanup.

10 years agoBetter statistics stuff.
Robert Haas [Mon, 30 Jul 2012 17:34:15 +0000 (17:34 +0000)]
Better statistics stuff.

10 years agoMinor code beautification.
Robert Haas [Mon, 30 Jul 2012 16:24:53 +0000 (16:24 +0000)]
Minor code beautification.

10 years agoStatistics code.
Robert Haas [Mon, 30 Jul 2012 16:22:12 +0000 (16:22 +0000)]
Statistics code.

10 years agoImprove comments about gc_next.
Robert Haas [Mon, 30 Jul 2012 15:49:18 +0000 (15:49 +0000)]
Improve comments about gc_next.

10 years agoCode rearrangement. Cosmetic only.
Robert Haas [Mon, 30 Jul 2012 13:27:10 +0000 (13:27 +0000)]
Code rearrangement.  Cosmetic only.

10 years agoAnother test case.
Robert Haas [Fri, 27 Jul 2012 18:28:04 +0000 (18:28 +0000)]
Another test case.

10 years agoFix another bug related to marked CHashPtrs.
Robert Haas [Fri, 27 Jul 2012 18:19:47 +0000 (18:19 +0000)]
Fix another bug related to marked CHashPtrs.

10 years agoImprove testing code to better diagnose concurrency bugs.
Robert Haas [Fri, 27 Jul 2012 17:49:12 +0000 (17:49 +0000)]
Improve testing code to better diagnose concurrency bugs.

10 years agoDon't bogusly propagate delete-marks.
Robert Haas [Fri, 27 Jul 2012 17:29:26 +0000 (17:29 +0000)]
Don't bogusly propagate delete-marks.

10 years agoAdd missing else.
Robert Haas [Fri, 27 Jul 2012 16:36:07 +0000 (16:36 +0000)]
Add missing else.

10 years agoThinko: of course, invalid CHashPtrs can also be delete-marked.
Robert Haas [Fri, 27 Jul 2012 16:34:50 +0000 (16:34 +0000)]
Thinko: of course, invalid CHashPtrs can also be delete-marked.

10 years agoConcurrency test function for chash.
Robert Haas [Fri, 27 Jul 2012 16:10:13 +0000 (16:10 +0000)]
Concurrency test function for chash.

10 years agoStupid bug fix.
Robert Haas [Fri, 27 Jul 2012 15:44:58 +0000 (15:44 +0000)]
Stupid bug fix.

10 years agoSeparate dynahash insert, search, delete tests.
Robert Haas [Fri, 27 Jul 2012 15:03:00 +0000 (11:03 -0400)]
Separate dynahash insert, search, delete tests.

10 years agoSeparate chash insert, search, delete tests.
Robert Haas [Fri, 27 Jul 2012 15:03:00 +0000 (11:03 -0400)]
Separate chash insert, search, delete tests.

10 years agoTest code for deletes, and associated bug fixes.
Robert Haas [Fri, 27 Jul 2012 04:22:47 +0000 (00:22 -0400)]
Test code for deletes, and associated bug fixes.

10 years agoAdd cleanup scan logic.
Robert Haas [Fri, 27 Jul 2012 04:14:08 +0000 (00:14 -0400)]
Add cleanup scan logic.

10 years agoBug fixes.
Robert Haas [Fri, 27 Jul 2012 03:51:08 +0000 (23:51 -0400)]
Bug fixes.

10 years agoUnify scan code.
Robert Haas [Thu, 26 Jul 2012 21:43:15 +0000 (17:43 -0400)]
Unify scan code.

10 years agoFurther simplifications.
Robert Haas [Thu, 26 Jul 2012 19:51:04 +0000 (15:51 -0400)]
Further simplifications.

10 years agoUpdate comments.
Robert Haas [Thu, 26 Jul 2012 19:24:19 +0000 (15:24 -0400)]
Update comments.

10 years agoAdapt code to use compare-and-swap.
Robert Haas [Thu, 26 Jul 2012 18:45:10 +0000 (14:45 -0400)]
Adapt code to use compare-and-swap.

10 years agoCHashAddToGarbage
Robert Haas [Thu, 26 Jul 2012 16:50:12 +0000 (12:50 -0400)]
CHashAddToGarbage

10 years agoFirst attempt at CHashDelete - slightly incomplete, and untested.
Robert Haas [Wed, 25 Jul 2012 21:10:29 +0000 (17:10 -0400)]
First attempt at CHashDelete - slightly incomplete, and untested.

10 years agoMore micro-optimization.
Robert Haas [Wed, 25 Jul 2012 20:05:50 +0000 (16:05 -0400)]
More micro-optimization.

10 years agoFix stupid thinko.
Robert Haas [Wed, 25 Jul 2012 17:39:55 +0000 (13:39 -0400)]
Fix stupid thinko.

10 years agoTime inserts, searches.
Robert Haas [Wed, 25 Jul 2012 16:24:24 +0000 (12:24 -0400)]
Time inserts, searches.

10 years agoSome micro-optimization and code beautification.
Robert Haas [Wed, 25 Jul 2012 16:18:31 +0000 (12:18 -0400)]
Some micro-optimization and code beautification.

10 years agoShow shared memory allocated for each hash table.
Robert Haas [Wed, 25 Jul 2012 15:58:47 +0000 (11:58 -0400)]
Show shared memory allocated for each hash table.

10 years agoImprove dynahash test code.
Robert Haas [Wed, 25 Jul 2012 15:35:47 +0000 (11:35 -0400)]
Improve dynahash test code.

10 years agoBeginnings of dynahash testing code.
Robert Haas [Wed, 25 Jul 2012 14:52:54 +0000 (10:52 -0400)]
Beginnings of dynahash testing code.

10 years agoAvoid leaking nodes on a failed insert.
Robert Haas [Wed, 25 Jul 2012 14:21:40 +0000 (10:21 -0400)]
Avoid leaking nodes on a failed insert.

10 years agoBetter debugging code, another bug fix.
Robert Haas [Wed, 25 Jul 2012 14:12:06 +0000 (10:12 -0400)]
Better debugging code, another bug fix.

10 years agoMore bug fixing.
Robert Haas [Wed, 25 Jul 2012 14:02:53 +0000 (10:02 -0400)]
More bug fixing.

10 years agoMore debugging code.
Robert Haas [Wed, 25 Jul 2012 13:59:03 +0000 (09:59 -0400)]
More debugging code.

10 years agoRemove debugging code.
Robert Haas [Wed, 25 Jul 2012 12:57:36 +0000 (08:57 -0400)]
Remove debugging code.

10 years agoTesting code and resulting bug fixes.
Robert Haas [Wed, 25 Jul 2012 04:21:37 +0000 (00:21 -0400)]
Testing code and resulting bug fixes.

10 years agoAn attempt at making insertion work.
Robert Haas [Tue, 24 Jul 2012 16:30:41 +0000 (12:30 -0400)]
An attempt at making insertion work.

10 years agoTabify.
Robert Haas [Tue, 24 Jul 2012 12:59:26 +0000 (08:59 -0400)]
Tabify.

10 years agoStart of work on GC.
Robert Haas [Sat, 14 Jul 2012 05:44:22 +0000 (01:44 -0400)]
Start of work on GC.

10 years agoMore initialization code.
Robert Haas [Fri, 13 Jul 2012 23:09:26 +0000 (19:09 -0400)]
More initialization code.

10 years agoSupport dependency barriers.
Robert Haas [Fri, 13 Jul 2012 20:33:41 +0000 (16:33 -0400)]
Support dependency barriers.

10 years agoFirst attempt at CHashSearch.
Robert Haas [Fri, 13 Jul 2012 20:25:35 +0000 (16:25 -0400)]
First attempt at CHashSearch.

10 years agoMore work on chash. Initialization theoretically works now.
Robert Haas [Fri, 13 Jul 2012 05:38:37 +0000 (01:38 -0400)]
More work on chash.  Initialization theoretically works now.

10 years agoStart of work on chash.
Robert Haas [Wed, 4 Jul 2012 18:50:19 +0000 (14:50 -0400)]
Start of work on chash.

10 years agoAdd a note to PG_TRY's documentation about volatile safety.
Tom Lane [Mon, 26 Jan 2015 20:53:37 +0000 (15:53 -0500)]
Add a note to PG_TRY's documentation about volatile safety.

We had better memorialize what the actual requirements are for this.

10 years agoFix volatile-safety issue in dblink's materializeQueryResult().
Tom Lane [Mon, 26 Jan 2015 20:17:33 +0000 (15:17 -0500)]
Fix volatile-safety issue in dblink's materializeQueryResult().

Some fields of the sinfo struct are modified within PG_TRY and then
referenced within PG_CATCH, so as with recent patch to async.c, "volatile"
is necessary for strict POSIX compliance; and that propagates to a couple
of subroutines as well as materializeQueryResult() itself.  I think the
risk of actual issues here is probably higher than in async.c, because
storeQueryResult() is likely to get inlined into materializeQueryResult(),
leaving the compiler free to conclude that its stores into sinfo fields are
dead code.

10 years agoRe-enable abbreviated keys on Windows.
Robert Haas [Mon, 26 Jan 2015 19:28:14 +0000 (14:28 -0500)]
Re-enable abbreviated keys on Windows.

Commit 1be4eb1b2d436d1375899c74e4c74486890d8777 disabled this, but I
think the real problem here was fixed by commit
b181a91981203f6ec9403115a2917bd3f9473707 and commit
d060e07fa919e0eb681e2fa2cfbe63d6c40eb2cf.  So let's try re-enabling
it now and see what happens.

10 years agoFix volatile-safety issue in pltcl_SPI_execute_plan().
Tom Lane [Mon, 26 Jan 2015 17:18:25 +0000 (12:18 -0500)]
Fix volatile-safety issue in pltcl_SPI_execute_plan().

The "callargs" variable is modified within PG_TRY and then referenced
within PG_CATCH, which is exactly the coding pattern we've now found
to be unsafe.  Marking "callargs" volatile would be problematic because
it is passed by reference to some Tcl functions, so fix the problem
by not modifying it within PG_TRY.  We can just postpone the free()
till we exit the PG_TRY construct, as is already done elsewhere in this
same file.

Also, fix failure to free(callargs) when exiting on too-many-arguments
error.  This is only a minor memory leak, but a leak nonetheless.

In passing, remove some unnecessary "volatile" markings in the same
function.  Those doubtless are there because gcc 2.95.3 whinged about
them, but we now know that its algorithm for complaining is many bricks
shy of a load.

This is certainly a live bug with compilers that optimize similarly
to current gcc, so back-patch to all active branches.

10 years agoFix volatile-safety issue in asyncQueueReadAllNotifications().
Tom Lane [Mon, 26 Jan 2015 16:57:33 +0000 (11:57 -0500)]
Fix volatile-safety issue in asyncQueueReadAllNotifications().

The "pos" variable is modified within PG_TRY and then referenced
within PG_CATCH, so for strict POSIX conformance it must be marked
volatile.  Superficially the code looked safe because pos's address
was taken, which was sufficient to force it into memory ... but it's
not sufficient to ensure that the compiler applies updates exactly
where the program text says to.  The volatility marking has to extend
into a couple of subroutines too, but I think that's probably a good
thing because the risk of out-of-order updates is mostly in those
subroutines not asyncQueueReadAllNotifications() itself.  In principle
the compiler could have re-ordered operations such that an error could
be thrown while "pos" had an incorrect value.

It's unclear how real the risk is here, but for safety back-patch
to all active branches.

10 years agoFurther cleanup of ReorderBufferCommit().
Tom Lane [Mon, 26 Jan 2015 03:49:56 +0000 (22:49 -0500)]
Further cleanup of ReorderBufferCommit().

On closer inspection, we can remove the "volatile" qualifier on
"using_subtxn" so long as we initialize that before the PG_TRY block,
which there's no particularly good reason not to do.
Also, push the "change" variable inside the PG_TRY so as to remove
all question of whether it needs "volatile", and remove useless
early initializations of "snapshow_now" and "using_subtxn".

10 years agoClean up assorted issues in ALTER SYSTEM coding.
Tom Lane [Mon, 26 Jan 2015 01:19:04 +0000 (20:19 -0500)]
Clean up assorted issues in ALTER SYSTEM coding.

Fix unsafe use of a non-volatile variable in PG_TRY/PG_CATCH in
AlterSystemSetConfigFile().  While at it, clean up a bundle of other
infelicities and outright bugs, including corner-case-incorrect linked list
manipulation, a poorly designed and worse documented parse-and-validate
function (which even included some randomly chosen hard-wired substitutes
for the specified elevel in one code path ... wtf?), direct use of open()
instead of fd.c's facilities, inadequate checking of write()'s return
value, and generally poorly written commentary.

10 years agoClean up some mess in row-security patches.
Tom Lane [Sat, 24 Jan 2015 21:16:22 +0000 (16:16 -0500)]
Clean up some mess in row-security patches.

Fix unsafe coding around PG_TRY in RelationBuildRowSecurity: can't change
a variable inside PG_TRY and then use it in PG_CATCH without marking it
"volatile".  In this case though it seems saner to avoid that by doing
a single assignment before entering the TRY block.

I started out just intending to fix that, but the more I looked at the
row-security code the more distressed I got.  This patch also fixes
incorrect construction of the RowSecurityPolicy cache entries (there was
not sufficient care taken to copy pass-by-ref data into the cache memory
context) and a whole bunch of sloppiness around the definition and use of
pg_policy.polcmd.  You can't use nulls in that column because initdb will
mark it NOT NULL --- and I see no particular reason why a null entry would
be a good idea anyway, so changing initdb's behavior is not the right
answer.  The internal value of '\0' wouldn't be suitable in a "char" column
either, so after a bit of thought I settled on using '*' to represent ALL.
Chasing those changes down also revealed that somebody wasn't paying
attention to what the underlying values of ACL_UPDATE_CHR etc really were,
and there was a great deal of lackadaiscalness in the catalogs.sgml
documentation for pg_policy and pg_policies too.

This doesn't pretend to be a complete code review for the row-security
stuff, it just fixes the things that were in my face while dealing with
the bugs in RelationBuildRowSecurity.

10 years agoFix unsafe coding in ReorderBufferCommit().
Tom Lane [Sat, 24 Jan 2015 18:25:19 +0000 (13:25 -0500)]
Fix unsafe coding in ReorderBufferCommit().

"iterstate" must be marked volatile since it's changed inside the PG_TRY
block and then used in the PG_CATCH stanza.  Noted by Mark Wilding of
Salesforce.  (We really need to see if we can't get the C compiler to warn
about this.)

Also, reset iterstate to NULL after the mainline ReorderBufferIterTXNFinish
call, to ensure the PG_CATCH block doesn't try to do that a second time.

10 years agoReplace a bunch more uses of strncpy() with safer coding.
Tom Lane [Sat, 24 Jan 2015 18:05:42 +0000 (13:05 -0500)]
Replace a bunch more uses of strncpy() with safer coding.

strncpy() has a well-deserved reputation for being unsafe, so make an
effort to get rid of nearly all occurrences in HEAD.

A large fraction of the remaining uses were passing length less than or
equal to the known strlen() of the source, in which case no null-padding
can occur and the behavior is equivalent to memcpy(), though doubtless
slower and certainly harder to reason about.  So just use memcpy() in
these cases.

In other cases, use either StrNCpy() or strlcpy() as appropriate (depending
on whether padding to the full length of the destination buffer seems
useful).

I left a few strncpy() calls alone in the src/timezone/ code, to keep it
in sync with upstream (the IANA tzcode distribution).  There are also a
few such calls in ecpg that could possibly do with more analysis.

AFAICT, none of these changes are more than cosmetic, except for the four
occurrences in fe-secure-openssl.c, which are in fact buggy: an overlength
source leads to a non-null-terminated destination buffer and ensuing
misbehavior.  These don't seem like security issues, first because no stack
clobber is possible and second because if your values of sslcert etc are
coming from untrusted sources then you've got problems way worse than this.
Still, it's undesirable to have unpredictable behavior for overlength
inputs, so back-patch those four changes to all active branches.

10 years agoRemove no-longer-referenced src/port/gethostname.c.
Tom Lane [Sat, 24 Jan 2015 17:13:57 +0000 (12:13 -0500)]
Remove no-longer-referenced src/port/gethostname.c.

This file hasn't been part of any build since 2005, and even before that
wasn't used unless you configured --with-krb4 (and had a machine without
gethostname(2), obviously).  What's more, we haven't actually called
gethostname anywhere since then, either (except in thread_test.c, whose
testing of this function is probably pointless).  So we don't need it.

10 years agoFix assignment operator thinko
Alvaro Herrera [Sat, 24 Jan 2015 14:15:56 +0000 (11:15 -0300)]
Fix assignment operator thinko

Pointed out by Michael Paquier

10 years agoFix typos, update README.
Robert Haas [Fri, 23 Jan 2015 20:06:29 +0000 (15:06 -0500)]
Fix typos, update README.

Peter Geoghegan

10 years agovacuumdb: enable parallel mode
Alvaro Herrera [Fri, 23 Jan 2015 18:02:45 +0000 (15:02 -0300)]
vacuumdb: enable parallel mode

This mode allows vacuumdb to open several server connections to vacuum
or analyze several tables simultaneously.

Author: Dilip Kumar.  Some reworking by Álvaro Herrera
Reviewed by: Jeff Janes, Amit Kapila, Magnus Hagander, Andres Freund

10 years agoDon't use abbreviated keys for the final merge pass.
Robert Haas [Fri, 23 Jan 2015 16:58:31 +0000 (11:58 -0500)]
Don't use abbreviated keys for the final merge pass.

When we write tuples out to disk and read them back in, the abbreviated
keys become non-abbreviated, because the readtup routines don't know
anything about abbreviation.  But without this fix, the rest of the
code still thinks the abbreviation-aware compartor should be used,
so chaos ensues.

Report by Andrew Gierth; patch by Peter Geoghegan.

10 years agoAdd an explicit cast to Size to hyperloglog.c
Robert Haas [Fri, 23 Jan 2015 16:44:51 +0000 (11:44 -0500)]
Add an explicit cast to Size to hyperloglog.c

MSVC generates a warning here; we hope this will make it happy.

Report by Michael Paquier.  Patch by David Rowley.

10 years agoPrevent duplicate escape-string warnings when using pg_stat_statements.
Tom Lane [Thu, 22 Jan 2015 23:10:47 +0000 (18:10 -0500)]
Prevent duplicate escape-string warnings when using pg_stat_statements.

contrib/pg_stat_statements will sometimes run the core lexer a second time
on submitted statements.  Formerly, if you had standard_conforming_strings
turned off, this led to sometimes getting two copies of any warnings
enabled by escape_string_warning.  While this is probably no longer a big
deal in the field, it's a pain for regression testing.

To fix, change the lexer so it doesn't consult the escape_string_warning
GUC variable directly, but looks at a copy in the core_yy_extra_type state
struct.  Then, pg_stat_statements can change that copy to disable warnings
while it's redoing the lexing.

It seemed like a good idea to make this happen for all three of the GUCs
consulted by the lexer, not just escape_string_warning.  There's not an
immediate use-case for callers to adjust the other two AFAIK, but making
it possible is easy enough and seems like good future-proofing.

Arguably this is a bug fix, but there doesn't seem to be enough interest to
justify a back-patch.  We'd not be able to back-patch exactly as-is anyway,
for fear of breaking ABI compatibility of the struct.  (We could perhaps
back-patch the addition of only escape_string_warning by adding it at the
end of the struct, where there's currently alignment padding space.)

10 years agoFix whitespace
Peter Eisentraut [Thu, 22 Jan 2015 21:57:16 +0000 (16:57 -0500)]
Fix whitespace

10 years agoTweak BRIN minmax operator class
Alvaro Herrera [Thu, 22 Jan 2015 20:01:09 +0000 (17:01 -0300)]
Tweak BRIN minmax operator class

In the union support proc, we were not checking the hasnulls flag of
value A early enough, so it could be skipped if the "allnulls" flag in
value B is set.  Also, a check on the allnulls flag of value "B" was
redundant, so remove it.

Also change inet_minmax_ops to not be the default opclass for type inet,
as a future inclusion operator class would be more useful and it's
pretty difficult to change default opclass for a datatype later on.
(There is no catversion bump for this catalog change; this shouldn't be
a problem.)

Extracted from a larger patch to add an "inclusion" operator class.

Author: Emre Hasegeli

10 years agodocs: update libpq's PQputCopyData and PQputCopyEnd
Bruce Momjian [Thu, 22 Jan 2015 18:30:08 +0000 (13:30 -0500)]
docs:  update libpq's PQputCopyData and PQputCopyEnd

Clarify the meaning of libpq return values for PQputCopyData and
PQputCopyEnd, particularly in non-blocking mode.

Report by Robert Haas

10 years agoRepair brain fade in commit b181a91981203f6ec9403115a2917bd3f9473707.
Robert Haas [Thu, 22 Jan 2015 17:47:46 +0000 (12:47 -0500)]
Repair brain fade in commit b181a91981203f6ec9403115a2917bd3f9473707.

The split between which things need to happen in the C-locale case and
which needed to happen in the locale-aware case was a few bricks short
of a load.  Try to fix that.

10 years agoadjust ACL owners for REASSIGN and ALTER OWNER TO
Bruce Momjian [Thu, 22 Jan 2015 17:36:34 +0000 (12:36 -0500)]
adjust ACL owners for REASSIGN and ALTER OWNER TO

When REASSIGN and ALTER OWNER TO are used, both the object owner and ACL
list should be changed from the old owner to the new owner. This patch
fixes types, foreign data wrappers, and foreign servers to change their
ACL list properly;  they already changed owners properly.

BACKWARD INCOMPATIBILITY?

Report by Alexey Bashtanov

10 years agoMore fixes for abbreviated keys infrastructure.
Robert Haas [Thu, 22 Jan 2015 16:58:58 +0000 (11:58 -0500)]
More fixes for abbreviated keys infrastructure.

First, when LC_COLLATE = C, bttext_abbrev_convert should use memcpy()
rather than strxfrm() to construct the abbreviated key, because the
authoritative comparator uses memcpy().  If we do anything else here,
we might get inconsistent answers, and the buildfarm says this risk
is not theoretical.  It should be faster this way, too.

Second, while I'm looking at bttext_abbrev_convert, convert a needless
use of goto into the loop it's trying to implement into an actual
loop.

Both of the above problems date to the original commit of abbreviated
keys, commit 4ea51cdfe85ceef8afabceb03c446574daa0ac23.

Third, fix a bogus assignment to tss->locale before tss is set up.
That's a new goof in commit b529b65d1bf8537ca7fa024760a9782d7c8b66e5.

10 years agoHeavily refactor btsortsupport_worker.
Robert Haas [Thu, 22 Jan 2015 15:46:42 +0000 (10:46 -0500)]
Heavily refactor btsortsupport_worker.

Prior to commit 4ea51cdfe85ceef8afabceb03c446574daa0ac23, this function
only had one job, which was to decide whether we could avoid trampolining
through the fmgr layer when performing sort comparisons.  As of that
commit, it has a second job, which is to decide whether we can use
abbreviated keys.  Unfortunately, those two tasks are somewhat intertwined
in the existing coding, which is likely why neither Peter Geoghegan nor
I noticed prior to commit that this calls pg_newlocale_from_collation() in
cases where it didn't previously.  The buildfarm noticed, though.

To fix, rewrite the logic so that the decision as to which comparator to
use is more cleanly separated from the decision about abbreviation.

10 years agoreinit.h: Fix typo in identification comment
Alvaro Herrera [Thu, 22 Jan 2015 15:26:51 +0000 (12:26 -0300)]
reinit.h: Fix typo in identification comment

Author: Sawada Masahiko

10 years agoDisable abbreviated keys on Windows.
Robert Haas [Wed, 21 Jan 2015 01:32:21 +0000 (20:32 -0500)]
Disable abbreviated keys on Windows.

Most of the Windows buildfarm members (bowerbird, hamerkop, currawong,
jacana, brolga) are unhappy with yesterday's abbreviated keys patch,
although there are some (narwhal, frogmouth) that seem OK with it.
Since there's no obvious pattern to explain why some are working and
others are failing, just disable this across-the-board on Windows for
now.  This is a bit unfortunate since the optimization will be a big
win in some cases, but we can't leave the buildfarm broken.

10 years agotools/ccsym: update for modern versions of gcc
Bruce Momjian [Tue, 20 Jan 2015 18:02:35 +0000 (13:02 -0500)]
tools/ccsym:  update for modern versions of gcc

This dumps the predefined preprocessor macros

10 years agoAdd strxfrm_l to list of functions where Windows adds an underscore.
Robert Haas [Tue, 20 Jan 2015 15:52:01 +0000 (10:52 -0500)]
Add strxfrm_l to list of functions where Windows adds an underscore.

Per buildfarm failure on bowerbird after last night's commit
4ea51cdfe85ceef8afabceb03c446574daa0ac23.

Peter Geoghegan