Re: jsonb and nested hstore

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonb and nested hstore
Date: 2014-02-26 22:10:42
Message-ID: 530E6662.8060101@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 02/26/2014 04:59 PM, Peter Geoghegan wrote:
> On Wed, Feb 26, 2014 at 1:23 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>>> + if (va->string.len == vb->string.len)
>>>> + {
>>>> + res = memcmp(va->string.val, vb->string.val,
>>>> va->string.len);
>>>> + if (res == 0 && arg)
>>>> + *(bool *) arg = true;
>>> Should be NULL, not 0.
>>
>> No, the compiler doesn't like that for int values.
> I'm confused. I just pulled from feodor/jsonb_and_hstore, and I do see
> a compiler warning (because the code reads "res == NULL", unlike
> above). It appears to have been that way in Git since last year. So,
> maybe Andres meant that it *should* look like this?
>
>

argh!

I forgot to save a file.

Here's what I get if it's NULL:

gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -g -I../../../../src/include
-D_GNU_SOURCE -I/usr/include/libxml2 -c -o jsonb_support.o
jsonb_support.c -MMD -MP -MF .deps/jsonb_support.Po
jsonb_support.c: In function ‘compareJsonbStringValue’:
jsonb_support.c:137:11: warning: comparison between pointer and
integer [enabled by default]

With 0 there is no complaint.

new patch attached, change pushed to github.

cheers

andrew

Attachment Content-Type Size
jsonb-13.patch.gz application/x-gzip 32.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-02-26 22:22:40 Re: Another possible corruption bug in 9.3.2 or possibly a known MultiXact problem?
Previous Message Stephen Frost 2014-02-26 22:09:18 Re: extension_control_path