Re: building extension with large string inserts

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tom van Tilburg <tom(dot)van(dot)tilburg(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: building extension with large string inserts
Date: 2017-07-05 14:57:12
Message-ID: 19243.1499266632@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 van Tilburg 2017-07-05 15:04:26 Re: building extension with large string inserts
Previous Message Adrian Klaver 2017-07-05 14:33:28 Re: Invalid field size