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