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@xxxxxxxxxxxxx> wrote:
Tom van Tilburg <tom.van.tilburg@xxxxxxxxx> 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