Re: building extension with large string inserts

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom van Tilburg <tom(dot)van(dot)tilburg(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: building extension with large string inserts
Date: 2017-07-05 15:23:04
Message-ID: CAKFQuwY-qcq9L_r4Ww5hLM2jpxsZi4WOcqKYi31umB_hMw3DmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jul 5, 2017 at 8:04 AM, Tom van Tilburg <tom(dot)van(dot)tilburg(at)gmail(dot)com>
wrote:

> I think I misunderstand. How would that help my insert statement?
> You would get INSERT INTO mytable VALUES ($ javascript with a lot of
> unescaped characters like /n " // etc. $);
>

​Tom Lane provided the relevant syntax link, though if you supply an
actual, shortened, example someone might show exactly what this all means
for you - or how you'd need to tweak your text to make it work.

$$ { "key1": "value"​,
"key2": "value" } $$

Will be inserted as-is, explicit newlines and all. Likewise,

$$ { "key1": "value", \n "key2": "value" } $$

will be inserted without any newlines and with a literal "\n" in the middle
of the text.

Unlike single-quote literals there is no alternate "E" form of
dollar-quoting that will cause the \n to be interpreted as a newline. In
practice its absence doesn't seem missed.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hans Schou 2017-07-05 15:26:38 Re: Re: Feature proposal, DBURL: psql pgsql://joe:p4zzw0rd@example.org:2345/dbname
Previous Message Hans Schou 2017-07-05 15:20:51 Re: Feature proposal, DBURL: psql pgsql://joe:p4zzw0rd@example.org:2345/dbname