Search Postgresql Archives

building extension with large string inserts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to build an extension where there is the need to insert large strings consisting of _javascript_ code. The easiest way to get these string currently into a table is by using

\set varname `cat mycode.js`
INSERT INTO mytable VALUES (:'varname');

and run this from the psql client.
psql will escape the string nicely and stuff it into a text field.

This does not work with extensions since I cannot use \set anywhere else than the psql client.

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. 

Best,
 Tom

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux