Re: building extension with large string inserts

From: Tom van Tilburg <tom(dot)van(dot)tilburg(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: building extension with large string inserts
Date: 2017-07-05 15:04:26
Message-ID: CAP3PPDg9qjuy0aKi2wKC643=5xoEknqRsfif+T_kwKuX7MqqSA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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. $);

and: Am I correct that INSERTS are the way to go in extensions?

Best,
Tom vT.

On Wed, Jul 5, 2017 at 4:57 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Tom van Tilburg <tom(dot)van(dot)tilburg(at)gmail(dot)com> writes:
> > I am trying to build an extension where there is the need to insert large
> > strings consisting of javascript code.
> > ...
> > What would be a proper way to get this code into a table via an
> extension?
> > I've been working on generating INSERT statements for the extension's sql
> > file but it seems a tedious job to escape the code myself.
>
> Can't you use a dollar-quoted string? You just need to pick a delimiter
> that doesn't appear anywhere in the javascript, say $JaVaScRiPt$ ...
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-07-05 15:08:16 Re: building extension with large string inserts
Previous Message Tom Lane 2017-07-05 14:57:12 Re: building extension with large string inserts