users/andresfreund/postgres.git
11 years agofindJsonbValueFromSuperHeader() primitive type ordering
Peter Geoghegan [Mon, 17 Mar 2014 22:30:55 +0000 (15:30 -0700)]
findJsonbValueFromSuperHeader() primitive type ordering

11 years agoOnly jsonb arrays are subscriptable
Peter Geoghegan [Mon, 17 Mar 2014 21:58:39 +0000 (14:58 -0700)]
Only jsonb arrays are subscriptable

11 years agouniqueifyJsonbArray() hasNonUniq coverage
Peter Geoghegan [Mon, 17 Mar 2014 21:42:39 +0000 (14:42 -0700)]
uniqueifyJsonbArray() hasNonUniq coverage

11 years agoProcess JSON data types
Peter Geoghegan [Mon, 17 Mar 2014 21:30:27 +0000 (14:30 -0700)]
Process JSON data types

11 years agoRemove header includes, unneeded after refactoring
Peter Geoghegan [Mon, 17 Mar 2014 20:58:23 +0000 (13:58 -0700)]
Remove header includes, unneeded after refactoring

11 years agofix hstore Makefile
Andrew Dunstan [Sun, 16 Mar 2014 14:29:14 +0000 (10:29 -0400)]
fix hstore Makefile

11 years agofix field name for estSize in hstore_to_jsonb*.
Andrew Dunstan [Sun, 16 Mar 2014 12:18:37 +0000 (08:18 -0400)]
fix field name for estSize in hstore_to_jsonb*.

11 years agoMerge branch 'master' into jsonb_and_hstore
Peter Geoghegan [Sun, 16 Mar 2014 08:48:11 +0000 (01:48 -0700)]
Merge branch 'master' into jsonb_and_hstore

Conflicts:
src/include/catalog/pg_amproc.h

11 years agoNotes on pair deduplication
Peter Geoghegan [Sun, 16 Mar 2014 07:55:24 +0000 (00:55 -0700)]
Notes on pair deduplication

11 years agoImprove checkStringLen() error message
Peter Geoghegan [Sun, 16 Mar 2014 07:06:28 +0000 (00:06 -0700)]
Improve checkStringLen() error message

11 years agoJsonbValue.size is an estimate
Peter Geoghegan [Sun, 16 Mar 2014 05:55:12 +0000 (22:55 -0700)]
JsonbValue.size is an estimate

11 years agoFurther elucidate key, value, pair differences
Peter Geoghegan [Sun, 16 Mar 2014 05:28:45 +0000 (22:28 -0700)]
Further elucidate key, value, pair differences

11 years agoExtensive comments on findJsonbValueFromSuperHeader
Peter Geoghegan [Sun, 16 Mar 2014 04:58:45 +0000 (21:58 -0700)]
Extensive comments on findJsonbValueFromSuperHeader

11 years agofindJsonbValueFromSuperHeaderLen() lives in jsonfuncs.c
Peter Geoghegan [Sun, 16 Mar 2014 03:54:23 +0000 (20:54 -0700)]
findJsonbValueFromSuperHeaderLen() lives in jsonfuncs.c

11 years agoBetter findJsonbValueFromSuperHeader* assertions
Peter Geoghegan [Sun, 16 Mar 2014 03:25:54 +0000 (20:25 -0700)]
Better findJsonbValueFromSuperHeader* assertions

11 years agoFurther small tweaks to compareJsonbSuperHeaderValue
Peter Geoghegan [Sun, 16 Mar 2014 03:09:47 +0000 (20:09 -0700)]
Further small tweaks to compareJsonbSuperHeaderValue

11 years agoTake more care within compareJsonbSuperHeaderValue().
Peter Geoghegan [Sun, 16 Mar 2014 02:16:23 +0000 (19:16 -0700)]
Take more care within compareJsonbSuperHeaderValue().

Prior coding did not take sufficient care in using internal Jsonb type
as a tie-breaker in all situations.  The prior practice of using a
JsonbIteratorNext() return code as a tie-breaker was bogus, or was at
the very least incredibly fragile.

11 years agochange oids to avoid upstream conflict with recent commit
Andrew Dunstan [Sat, 15 Mar 2014 21:46:22 +0000 (17:46 -0400)]
change oids to avoid upstream conflict with recent commit

11 years agoHarmonize macro alignment
Peter Geoghegan [Sat, 15 Mar 2014 20:50:18 +0000 (13:50 -0700)]
Harmonize macro alignment

11 years agoOn second thought, have macros live in jsonb.h
Peter Geoghegan [Sat, 15 Mar 2014 20:44:23 +0000 (13:44 -0700)]
On second thought, have macros live in jsonb.h

11 years agoFirst-draft release notes for 9.3.4.
Tom Lane [Sat, 15 Mar 2014 19:58:59 +0000 (15:58 -0400)]
First-draft release notes for 9.3.4.

As usual, the release notes for older branches will be made by cutting
these down, but put them up for community review first.

11 years agoUpdate time zone data files to tzdata release 2014a.
Tom Lane [Sat, 15 Mar 2014 17:36:07 +0000 (13:36 -0400)]
Update time zone data files to tzdata release 2014a.

DST law changes in Fiji, Turkey; historical changes in Israel, Ukraine.

11 years agoFix copyright year
Peter Geoghegan [Sat, 15 Mar 2014 11:06:37 +0000 (04:06 -0700)]
Fix copyright year

11 years agoRename jsonb_support.c to jsonb_util.c
Peter Geoghegan [Sat, 15 Mar 2014 11:04:12 +0000 (04:04 -0700)]
Rename jsonb_support.c to jsonb_util.c

11 years agoinitdb required: Refactor hashing
Peter Geoghegan [Sat, 15 Mar 2014 10:52:51 +0000 (03:52 -0700)]
initdb required: Refactor hashing

Do some variability and commonality analysis among jsonb_hash and the
jsonb_hash_ops opclass.  Eliminate some redundant code.  Totally remove
the slightly dubious practice of using a CRC32 for hashing.

11 years agoClarify point in some jsonfuncs.c operator functions
Peter Geoghegan [Sat, 15 Mar 2014 08:45:59 +0000 (01:45 -0700)]
Clarify point in some jsonfuncs.c operator functions

The danger of this error message causing confusion is quite acute if we
assume that expressional indexing will be used extensively, because the
restriction on, say, calling the "jsonb -> text" operator only on what
jsonb internally knows to be an object effectively makes every such
expressional index a constraint on same (at least without some further
care).

Note this general risk in the documentation, too.

11 years agoDelete hstore--1.2.sql
Peter Geoghegan [Sat, 15 Mar 2014 08:10:39 +0000 (01:10 -0700)]
Delete hstore--1.2.sql

11 years agoMore comments on default GIN opclass
Peter Geoghegan [Sat, 15 Mar 2014 08:07:28 +0000 (01:07 -0700)]
More comments on default GIN opclass

11 years agoRefactor deepContains(), and move to jsonb_support.c
Peter Geoghegan [Sat, 15 Mar 2014 06:47:24 +0000 (23:47 -0700)]
Refactor deepContains(), and move to jsonb_support.c

Tweak the deepContains() implementation. Add extensive comments where
before there were very few.

The new location seems more appropriate, and allows jsonb_ops.c to
consist only of client functions to what could broadly be classified as
"walker infrastructure" that now all lives in jsonb_support.c.

A few other jsonb_support.c tweaks are made in passing.

11 years agoSimilar emphasis for other containment operators
Peter Geoghegan [Fri, 14 Mar 2014 23:13:40 +0000 (16:13 -0700)]
Similar emphasis for other containment operators

11 years agoDocument ? operator limitation
Peter Geoghegan [Fri, 14 Mar 2014 22:57:23 +0000 (15:57 -0700)]
Document ? operator limitation

11 years agoFix race condition in B-tree page deletion.
Heikki Linnakangas [Fri, 14 Mar 2014 13:43:58 +0000 (15:43 +0200)]
Fix race condition in B-tree page deletion.

In short, we don't allow a page to be deleted if it's the rightmost child
of its parent, but that situation can change after we check for it.

Problem
-------

We check that the page to be deleted is not the rightmost child of its
parent, and then lock its left sibling, the page itself, its right sibling,
and the parent, in that order. However, if the parent page is split after
the check but before acquiring the locks, the target page might become the
rightmost child, if the split happens at the right place. That leads to an
error in vacuum (I reproduced this by setting a breakpoint in debugger):

ERROR:  failed to delete rightmost child 41 of block 3 in index "foo_pkey"

We currently re-check that the page is still the rightmost child, and throw
the above error if it's not. We could easily just give up rather than throw
an error, but that approach doesn't scale to half-dead pages. To recap,
although we don't normally allow deleting the rightmost child, if the page
is the *only* child of its parent, we delete the child page and mark the
parent page as half-dead in one atomic operation. But before we do that, we
check that the parent can later be deleted, by checking that it in turn is
not the rightmost child of the grandparent (potentially recursing all the
way up to the root). But the same situation can arise there - the
grandparent can be split while we're not holding the locks. We end up with
a half-dead page that we cannot delete.

To make things worse, the keyspace of the deleted page has already been
transferred to its right sibling. As the README points out, the keyspace at
the grandparent level is "out-of-whack" until the half-dead page is deleted,
and if enough tuples with keys in the transferred keyspace are inserted, the
page might get split and a downlink might be inserted into the grandparent
that is out-of-order. That might not cause any serious problem if it's
transient (as the README ponders), but is surely bad if it stays that way.

Solution
--------

This patch changes the page deletion algorithm to avoid that problem. After
checking that the topmost page in the chain of to-be-deleted pages is not
the rightmost child of its parent, and then deleting the pages from bottom
up, unlink the pages from top to bottom. This way, the intermediate stages
are similar to the intermediate stages in page splitting, and there is no
transient stage where the keyspace is "out-of-whack". The topmost page in
the to-be-deleted chain doesn't have a downlink pointing to it, like a page
split before the downlink has been inserted.

This also allows us to get rid of the cleanup step after WAL recovery, if we
crash during page deletion. The deletion will be continued at next VACUUM,
but the tree is consistent for searches and insertions at every step.

This bug is old, all supported versions are affected, but this patch is too
big to back-patch (and changes the WAL record formats of related records).
We have not heard any reports of the bug from users, so clearly it's not
easy to bump into. Maybe backpatch later, after this has had some field
testing.

Reviewed by Kevin Grittner and Peter Geoghegan.

11 years agoinitdb required: GIN compare support function
Peter Geoghegan [Fri, 14 Mar 2014 07:40:48 +0000 (00:40 -0700)]
initdb required: GIN compare support function

Previously, the jsonb_ops GIN opclass followed the example of
gin_hstore_ops in using bttextcmp() as its support function 1.  This
makes a certain amount of sense, since the opclass storage format is
text in both cases.  However, there is no need to pay the additional
overhead of collation-aware comparisons, since the ordering of keys
serialized as text within a gin_jsonb_ops GIN B-Tree is merely an
implementation detail of no consequence to users.

In passing, perform a little diff minimization.

11 years agoRemarks on GIN numeric textual storage
Peter Geoghegan [Fri, 14 Mar 2014 06:34:31 +0000 (23:34 -0700)]
Remarks on GIN numeric textual storage

11 years agoPrevent interrupts while reporting non-ERROR elog messages.
Tom Lane [Fri, 14 Mar 2014 00:59:42 +0000 (20:59 -0400)]
Prevent interrupts while reporting non-ERROR elog messages.

This should eliminate the risk of recursive entry to syslog(3), which
appears to be the cause of the hang reported in bug #9551 from James
Morton.

Arguably, the real problem here is auth.c's willingness to turn on
ImmediateInterruptOK while executing fairly wide swaths of backend code.
We may well need to work at narrowing the code ranges in which the
authentication_timeout interrupt is enabled.  For the moment, though,
this is a cheap and reasonably noninvasive fix for a field-reported
failure; the other approach would be complex and not necessarily
bug-free itself.

Back-patch to all supported branches.

11 years agoBe careful about freeing memory in comparator
Peter Geoghegan [Fri, 14 Mar 2014 00:43:33 +0000 (17:43 -0700)]
Be careful about freeing memory in comparator

11 years agoUse a possibly less confusing name for turning a json string into a jsonb.
Andrew Dunstan [Thu, 13 Mar 2014 21:33:41 +0000 (17:33 -0400)]
Use a possibly less confusing name for turning a json string into a jsonb.

11 years agoSignificant further JsonbIteratorNext() clean-up
Peter Geoghegan [Thu, 13 Mar 2014 20:51:10 +0000 (13:51 -0700)]
Significant further JsonbIteratorNext() clean-up

Clarify issues around memory management, and the role of each of the
helper functions at each point.

11 years agoAllow psql to print COPY command status in more cases.
Tom Lane [Thu, 13 Mar 2014 17:49:03 +0000 (13:49 -0400)]
Allow psql to print COPY command status in more cases.

Previously, psql would print the "COPY nnn" command status only for COPY
commands executed server-side.  Now it will print that for frontend copies
too (including \copy).  However, we continue to suppress the command status
for COPY TO STDOUT, since in that case the copy data has been routed to the
same place that the command status would go, and there is a risk of the
status line being mistaken for another line of COPY data.  Doing that would
break existing scripts, and it doesn't seem worth the benefit --- this case
seems fairly analogous to SELECT, for which we also suppress the command
status.

Kumar Rajeev Rastogi, with substantial review by Amit Khandekar

11 years agoAvoid transaction-commit race condition while receiving a NOTIFY message.
Tom Lane [Thu, 13 Mar 2014 16:02:54 +0000 (12:02 -0400)]
Avoid transaction-commit race condition while receiving a NOTIFY message.

Use TransactionIdIsInProgress, then TransactionIdDidCommit, to distinguish
whether a NOTIFY message's originating transaction is in progress,
committed, or aborted.  The previous coding could accept a message from a
transaction that was still in-progress according to the PGPROC array;
if the client were fast enough at starting a new transaction, it might fail
to see table rows added/updated by the message-sending transaction.  Which
of course would usually be the point of receiving the message.  We noted
this type of race condition long ago in tqual.c, but async.c overlooked it.

The race condition probably cannot occur unless there are multiple NOTIFY
senders in action, since an individual backend doesn't send NOTIFY signals
until well after it's done committing.  But if two senders commit in close
succession, it's certainly possible that we could see the second sender's
message within the race condition window while responding to the signal
from the first one.

Per bug #9557 from Marko Tiikkaja.  This patch is slightly more invasive
than what he proposed, since it removes the now-redundant
TransactionIdDidAbort call.

Back-patch to 9.0, where the current NOTIFY implementation was introduced.

11 years agoFix a couple of typos in docs.
Heikki Linnakangas [Thu, 13 Mar 2014 13:01:45 +0000 (15:01 +0200)]
Fix a couple of typos in docs.

Thom Brown

11 years agoAdd GIN_SEARCH_MODE_ALL test coverage
Peter Geoghegan [Thu, 13 Mar 2014 10:53:50 +0000 (03:53 -0700)]
Add GIN_SEARCH_MODE_ALL test coverage

11 years agoMore dead code removal
Peter Geoghegan [Thu, 13 Mar 2014 09:53:25 +0000 (02:53 -0700)]
More dead code removal

11 years agoMacro alignment consistency
Peter Geoghegan [Thu, 13 Mar 2014 09:10:52 +0000 (02:10 -0700)]
Macro alignment consistency

11 years agoPrefer sizeof(type)
Peter Geoghegan [Thu, 13 Mar 2014 09:03:02 +0000 (02:03 -0700)]
Prefer sizeof(type)

This especially applies to memory allocation.  There were a number of
expressions that rather confusingly referenced dereferenced anonymous
struct members and things like that.

11 years agoComments on findJsonbValueFromSuperHeader()
Peter Geoghegan [Thu, 13 Mar 2014 08:20:51 +0000 (01:20 -0700)]
Comments on findJsonbValueFromSuperHeader()

11 years agoFix-up jsonb macros
Peter Geoghegan [Thu, 13 Mar 2014 07:38:12 +0000 (00:38 -0700)]
Fix-up jsonb macros

11 years agoConsistent variable naming
Peter Geoghegan [Thu, 13 Mar 2014 07:21:27 +0000 (00:21 -0700)]
Consistent variable naming

11 years agojsonb.h macro alignment
Peter Geoghegan [Thu, 13 Mar 2014 07:08:18 +0000 (00:08 -0700)]
jsonb.h macro alignment

11 years agoRemove more dead code in jsonb_exists_all()
Peter Geoghegan [Thu, 13 Mar 2014 06:29:23 +0000 (23:29 -0700)]
Remove more dead code in jsonb_exists_all()

11 years agoRemove more dead code
Peter Geoghegan [Thu, 13 Mar 2014 05:43:36 +0000 (22:43 -0700)]
Remove more dead code

11 years agoC comments: remove odd blank lines after #ifdef WIN32 lines
Bruce Momjian [Thu, 13 Mar 2014 05:42:24 +0000 (01:42 -0400)]
C comments:  remove odd blank lines after #ifdef WIN32 lines

A few more

11 years agoRemove dead code
Peter Geoghegan [Thu, 13 Mar 2014 05:34:59 +0000 (22:34 -0700)]
Remove dead code

gconv shows that the jbvBinary switch case within putStringConversion()
to be dead code.  This is unsurprising, as this is not one of the
contexts in which a scalar can be a binary.

11 years agoC comments: remove odd blank lines after #ifdef WIN32 lines
Bruce Momjian [Thu, 13 Mar 2014 05:34:42 +0000 (01:34 -0400)]
C comments:  remove odd blank lines after #ifdef WIN32 lines

11 years agoRemove questionable coding practices
Peter Geoghegan [Thu, 13 Mar 2014 04:43:17 +0000 (21:43 -0700)]
Remove questionable coding practices

Don't return a pointer to static memory in a couple of functions.  Just
palloc() it and be done.  There is no reason to think we're particularly
sensitive to leaking memory in the relevant contexts (although I should
revisit memory leaks within B-Tree support function 1).

Also, don't XOR togther enum constants and WJB_* constants within
JsonbIteratorNext().

11 years agoClean-up "compression walking"
Peter Geoghegan [Thu, 13 Mar 2014 02:28:47 +0000 (19:28 -0700)]
Clean-up "compression walking"

This doesn't have much to do with actual compression.  It actually
concerns converting an arbitrary JsonbValue to a 4 byte uncompressed
varlena representation (i.e. a Jsonb).  So stop using the misleading
term  compression, and start calling it conversion.  Use the type system
sensibly.  Clean-up and comment the code more generally.

11 years agoIntroduce "superheader" abstraction
Peter Geoghegan [Thu, 13 Mar 2014 01:10:12 +0000 (18:10 -0700)]
Introduce "superheader" abstraction

This makes it clearer how the nested structure can be interacted with
through either a varlena Jsonb buffer pointer, or a (nested) pointer to
a Jentry (which has a header...so we might be accessing that through
what is nominally a superheader pointer, and it doesn't matter).

This makes the structure of much of jsonb_support.c a lot clearer.

11 years agoCorrect serialize/deserialize confusion
Peter Geoghegan [Wed, 12 Mar 2014 22:54:27 +0000 (15:54 -0700)]
Correct serialize/deserialize confusion

11 years agoClarify role of dataProper
Peter Geoghegan [Wed, 12 Mar 2014 22:44:02 +0000 (15:44 -0700)]
Clarify role of dataProper

11 years agoClean up iterator struct
Peter Geoghegan [Wed, 12 Mar 2014 22:31:01 +0000 (15:31 -0700)]
Clean up iterator struct

11 years agoOnly WAL-log the modified portion in an UPDATE, if possible.
Heikki Linnakangas [Wed, 12 Mar 2014 20:46:04 +0000 (22:46 +0200)]
Only WAL-log the modified portion in an UPDATE, if possible.

When a row is updated, and the new tuple version is put on the same page as
the old one, only WAL-log the part of the new tuple that's not identical to
the old. This saves significantly on the amount of WAL that needs to be
written, in the common case that most fields are not modified.

Amit Kapila, with a lot of back and forth with me, Robert Haas, and others.

11 years agoRemove unused python-style negative subscripting code
Peter Geoghegan [Wed, 12 Mar 2014 20:12:50 +0000 (13:12 -0700)]
Remove unused python-style negative subscripting code

11 years agoItems on GIN data pages are no longer always 6 bytes; update gincostestimate.
Heikki Linnakangas [Wed, 12 Mar 2014 18:43:07 +0000 (20:43 +0200)]
Items on GIN data pages are no longer always 6 bytes; update gincostestimate.

Also improve the comments a bit.

11 years agoShow PIDs of lock holders and waiters in log_lock_waits log message.
Fujii Masao [Wed, 12 Mar 2014 18:26:47 +0000 (03:26 +0900)]
Show PIDs of lock holders and waiters in log_lock_waits log message.

Christian Kruse, reviewed by Kumar Rajeev Rastogi.

11 years agotest_decoding: Documentation fix.
Robert Haas [Wed, 12 Mar 2014 18:11:06 +0000 (14:11 -0400)]
test_decoding: Documentation fix.

Andres Freund

11 years agoFix incorrect assertion about historical snapshots.
Robert Haas [Wed, 12 Mar 2014 18:07:41 +0000 (14:07 -0400)]
Fix incorrect assertion about historical snapshots.

Also fix some nearby comments.

Andres Freund

11 years agoComment fixes related to logical decoding.
Robert Haas [Wed, 12 Mar 2014 18:03:09 +0000 (14:03 -0400)]
Comment fixes related to logical decoding.

Andres Freund, per complaints by Peter Eisentraut.

11 years agoAllow opclasses to provide tri-valued GIN consistent functions.
Heikki Linnakangas [Wed, 12 Mar 2014 15:13:22 +0000 (17:13 +0200)]
Allow opclasses to provide tri-valued GIN consistent functions.

With the GIN "fast scan" feature, GIN can skip items without fetching all
the keys for them, if it can prove that they don't match regardless of
those keys. So far, it has done the proving by calling the boolean
consistent function with all combinations of TRUE/FALSE for the unfetched
keys, but since that's O(n^2), it becomes unfeasible with more than a few
keys. We can avoid calling consistent with all the combinations, if we can
tell the operator class implementation directly which keys are unknown.

This commit includes a triConsistent function for the built-in array and
tsvector opclasses.

Alexander Korotkov, with some changes by me.

11 years agoRemove path separator
Peter Geoghegan [Wed, 12 Mar 2014 08:55:08 +0000 (01:55 -0700)]
Remove path separator

11 years agoMinor simplification
Peter Geoghegan [Wed, 12 Mar 2014 08:46:24 +0000 (01:46 -0700)]
Minor simplification

11 years agoRemove unnecessary header includes
Peter Geoghegan [Wed, 12 Mar 2014 08:36:50 +0000 (01:36 -0700)]
Remove unnecessary header includes

11 years agoUse hash_any(), not crc32
Peter Geoghegan [Wed, 12 Mar 2014 08:29:34 +0000 (01:29 -0700)]
Use hash_any(), not crc32

11 years agoIn WAL replay, restore GIN metapage unconditionally to avoid torn page.
Heikki Linnakangas [Wed, 12 Mar 2014 07:59:49 +0000 (09:59 +0200)]
In WAL replay, restore GIN metapage unconditionally to avoid torn page.

We don't take a full-page image of the GIN metapage; instead, the WAL record
contains all the information required to reconstruct it from scratch. But
to avoid torn page hazards, we must re-initialize it from the WAL record
every time, even if it already has a greater LSN, similar to how normal full
page images are restored.

This was highly unlikely to cause any problems in practice, because the GIN
metapage is small. We rely on an update smaller than a 512 byte disk sector
to be atomic elsewhere, at least in pg_control. But better safe than sorry,
and this would be easy to overlook if more fields are added to the metapage
so that it's no longer small.

Reported by Noah Misch. Backpatch to all supported versions.

11 years agoTrim some operator code
Peter Geoghegan [Wed, 12 Mar 2014 06:02:10 +0000 (23:02 -0700)]
Trim some operator code

11 years agoRelocate some support functions
Peter Geoghegan [Wed, 12 Mar 2014 05:17:46 +0000 (22:17 -0700)]
Relocate some support functions

11 years agoFormalize enum value assert pattern
Peter Geoghegan [Wed, 12 Mar 2014 05:11:00 +0000 (22:11 -0700)]
Formalize enum value assert pattern

11 years agoUse lengthCompareJsonbStringValue where possible.
Peter Geoghegan [Wed, 12 Mar 2014 04:56:38 +0000 (21:56 -0700)]
Use lengthCompareJsonbStringValue where possible.

This clarifies the role of length-based sorting, and lexical sorting.

11 years agoRestructure loop
Peter Geoghegan [Wed, 12 Mar 2014 04:23:36 +0000 (21:23 -0700)]
Restructure loop

11 years agoDon't incorrectly free iterators after all
Peter Geoghegan [Wed, 12 Mar 2014 04:19:09 +0000 (21:19 -0700)]
Don't incorrectly free iterators after all

11 years agoMake some insufficient effort to not leak memory in bt support 1 routine
Peter Geoghegan [Wed, 12 Mar 2014 04:16:24 +0000 (21:16 -0700)]
Make some insufficient effort to not leak memory in bt support 1 routine

11 years agoClean up around lexical comparisons
Peter Geoghegan [Wed, 12 Mar 2014 04:07:46 +0000 (21:07 -0700)]
Clean up around lexical comparisons

11 years agoMerge remote-tracking branch 'feodor/jsonb_and_hstore' into jsonb_and_hstore
Peter Geoghegan [Wed, 12 Mar 2014 03:24:19 +0000 (20:24 -0700)]
Merge remote-tracking branch 'feodor/jsonb_and_hstore' into jsonb_and_hstore

11 years agoRefactor, cleaning up mess around unique-ifying
Peter Geoghegan [Wed, 12 Mar 2014 03:23:56 +0000 (20:23 -0700)]
Refactor, cleaning up mess around unique-ifying

11 years agoAdd hstore_to_jsonb, hstore_to_jsonb_loose functions and cast
Andrew Dunstan [Wed, 12 Mar 2014 03:07:21 +0000 (23:07 -0400)]
Add hstore_to_jsonb, hstore_to_jsonb_loose functions and cast

11 years agocompareJsonbStringValue is private
Peter Geoghegan [Wed, 12 Mar 2014 02:49:36 +0000 (19:49 -0700)]
compareJsonbStringValue is private

Made possible by last commit

11 years agoMove array to jsonb sorted array function
Peter Geoghegan [Wed, 12 Mar 2014 02:41:18 +0000 (19:41 -0700)]
Move array to jsonb sorted array function

11 years agoNote on binary search
Peter Geoghegan [Wed, 12 Mar 2014 02:33:03 +0000 (19:33 -0700)]
Note on binary search

11 years agoRemove == true idiom
Peter Geoghegan [Wed, 12 Mar 2014 02:30:23 +0000 (19:30 -0700)]
Remove == true idiom

11 years agoClean-up padding of unaligned jsonb internal types
Peter Geoghegan [Wed, 12 Mar 2014 01:46:20 +0000 (18:46 -0700)]
Clean-up padding of unaligned jsonb internal types

11 years agoClean-up tree walk logic. Remove unnecessary callback.
Peter Geoghegan [Wed, 12 Mar 2014 01:07:50 +0000 (18:07 -0700)]
Clean-up tree walk logic. Remove unnecessary callback.

11 years agoLose unnecessary walkUncompressedJsonbDo indirection
Peter Geoghegan [Wed, 12 Mar 2014 00:15:49 +0000 (17:15 -0700)]
Lose unnecessary walkUncompressedJsonbDo indirection

11 years agoRemove GiST support
Peter Geoghegan [Tue, 11 Mar 2014 21:47:31 +0000 (14:47 -0700)]
Remove GiST support

Given time pressures, and the fact that there is an unknown bug, it
makes sense to drop this for 9.4.

11 years agojsonb_1.out fixes missed earlier
Peter Geoghegan [Tue, 11 Mar 2014 08:01:40 +0000 (01:01 -0700)]
jsonb_1.out fixes missed earlier

11 years agoTweaks
Peter Geoghegan [Tue, 11 Mar 2014 07:53:44 +0000 (00:53 -0700)]
Tweaks

JsonbIteratorGet() name and position altered.

Consistently use the term "scalar" in preference to the RFC term
"primitive" internally.

11 years agoFix from Alexander for jsonb_hash_ops @> issue
Peter Geoghegan [Tue, 11 Mar 2014 01:21:49 +0000 (18:21 -0700)]
Fix from Alexander for jsonb_hash_ops @> issue

11 years agoMerge branch 'master' into jsonb
Andrew Dunstan [Mon, 10 Mar 2014 20:41:32 +0000 (16:41 -0400)]
Merge branch 'master' into jsonb

11 years agoFix tracking of psql script line numbers during \copy from another place.
Tom Lane [Mon, 10 Mar 2014 19:47:06 +0000 (15:47 -0400)]
Fix tracking of psql script line numbers during \copy from another place.

Commit 08146775acd8bfe0fcc509c71857abb928697171 changed do_copy() to
temporarily scribble on pset.cur_cmd_source.  That was a mighty ugly bit of
code in any case, but in particular it broke handleCopyIn's ability to tell
whether it was reading from the current script source file (in which case
pset.lineno should be incremented for each line of COPY data), or from
someplace else (in which case it shouldn't).  The former case still worked,
the latter not so much.  The visible effect was that line numbers reported
for errors in a script file would be wrong if there were an earlier \copy
that was reading anything other than inline-in-the-script-file data.

To fix, introduce another pset field that holds the file do_copy wants the
COPY code to use.  This is a little bit ugly, but less so than passing the
file down explicitly through several layers that aren't COPY-specific.

Extracted from a larger patch by Kumar Rajeev Rastogi; that patch also
changes printing of COPY command tags, which is not a bug fix and shouldn't
get back-patched.  This particular idea was from a suggestion by Amit
Khandekar, if I'm reading the thread correctly.

Back-patch to 9.2 where the faulty code was introduced.

11 years agoAllow dynamic shared memory segments to be kept until shutdown.
Robert Haas [Mon, 10 Mar 2014 18:04:47 +0000 (14:04 -0400)]
Allow dynamic shared memory segments to be kept until shutdown.

Amit Kapila, reviewed by Kyotaro Horiguchi, with some further
changes by me.

11 years agoAllow logical decoding via the walsender interface.
Robert Haas [Mon, 10 Mar 2014 17:50:28 +0000 (13:50 -0400)]
Allow logical decoding via the walsender interface.

In order for this to work, walsenders need the optional ability to
connect to a database, so the "replication" keyword now allows true
or false, for backward-compatibility, and the new value "database"
(which causes the "dbname" parameter to be respected).

walsender needs to loop not only when idle but also when sending
decoded data to the user and when waiting for more xlog data to decode.
This means that there are now three separate loops inside walsender.c;
although some refactoring has been done here, this is still a bit ugly.

Andres Freund, with contributions from Γlvaro Herrera, and further
review by me.

11 years agoTeach on_exit_reset() to discard pending cleanups for dsm.
Robert Haas [Mon, 10 Mar 2014 14:17:19 +0000 (10:17 -0400)]
Teach on_exit_reset() to discard pending cleanups for dsm.

If a postmaster child invokes fork() and then calls on_exit_reset, that
should be sufficient to let it exit() without breaking anything, but
dynamic shared memory broke that by not updating on_exit_reset() to
discard callbacks registered with dynamic shared memory segments.

Per investigation of a complaint from Tom Lane.