From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Cc: | sdiz(at)sdiz(dot)net |
Subject: | Brain fade in gin_extract_jsonb_path() |
Date: | 2015-11-05 20:39:09 |
Message-ID: | 31983.1446755949@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I looked into bug #13756,
http://www.postgresql.org/message-id/20151105171933.14035.25039@wrigleys.postgresql.org
The cause of the problem is that gin_extract_jsonb_path() computes
a different hash for the "2" in
{"a":[ ["b",{"x":1}], ["b",{"x":2}]]}
than it does for the "2" in
{"a":[[{"x":2}]]}
And the cause of that is that it supposes that after emitting a hash
for a VALUE, it can just leave stack->hash to be reinitialized by the
next KEY or ELEM. But if the next thing is a sub-object, we propagate
the previous value's hash down into the sub-object, causing values
therein to receive different hashes than they'd have gotten without
the preceding outer-level VALUE.
The attached one-liner fixes it, but of course this means that on-disk
jsonb_path_ops indexes are possibly broken and will need to be reindexed.
I see no way around that ... does anybody else?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
bug-13756-fix.patch | text/x-diff | 823 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Catalin Iacob | 2015-11-05 20:53:28 | Re: proposal: multiple psql option -c |
Previous Message | Fabien COELHO | 2015-11-05 20:33:15 | Re: extend pgbench expressions with functions |