pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-committers@postgresql.org
Subject: Re: pgsql: Rename jsonb_replace to jsonb_set and allow it to add new values
Date: Sun, 31 May 2015 22:25:23 -0400
Message-ID: <14172.1433125523@sss.pgh.pa.us> (raw)
In-Reply-To: <556BC152.8000508@dunslane.net>
References: <E1YzDpW-0005io-D5@gemulon.postgresql.org>
	<4442.1433122849@sss.pgh.pa.us>
	<556BBA3C.4020406@dunslane.net>
	<5085.1433124399@sss.pgh.pa.us>
	<556BC152.8000508@dunslane.net>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Andrew Dunstan <andrew@dunslane.net> writes:
> well, that's what we have a buildfarm for.

It looks like this problem is in setPathObject:

setPathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
              int path_len, JsonbParseState **st, int level,
              Jsonb *newval, uint32 npairs, bool create)
{
    JsonbValue    v;
    int            i;
    JsonbValue    k;
    bool        done = false;

    if (level >= path_len || path_nulls[level])
        done = true;

    /* empty object is a special case for create */
    if ((npairs == 0) && create && (level == path_len - 1))
    {
        JsonbValue    new = k;

        new.val.string.len = VARSIZE_ANY_EXHDR(path_elems[level]);
        new.val.string.val = VARDATA_ANY(path_elems[level]);

        (void) pushJsonbValue(st, WJB_KEY, &new);

Since "k" is undefined at this point, initializing "new" that way is pure
hogwash.  I'm surprised gcc doesn't complain about it.

(BTW, could I lobby to not use "new" as a variable name?  lldb gets
confused, probably because "new" is a C++ keyword.)

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



view thread (9+ messages)  latest in thread

Message-ID: <14172.1433125523@sss.pgh.pa.us>
Permalink:  ../14172.1433125523@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14172.1433125523@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andrew@dunslane.net
  Subject: Re: pgsql: Rename jsonb_replace to jsonb_set and allow it to add new values
  In-Reply-To: <14172.1433125523@sss.pgh.pa.us>
  References: <E1YzDpW-0005io-D5@gemulon.postgresql.org> <4442.1433122849@sss.pgh.pa.us> <556BBA3C.4020406@dunslane.net> <5085.1433124399@sss.pgh.pa.us> <556BC152.8000508@dunslane.net> <14172.1433125523@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox