Re: [GENERAL] building extension with large string inserts

2017-07-05 Thread David G. Johnston
On Wed, Jul 5, 2017 at 8:04 AM, Tom van Tilburg wrote: > 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. $); > ​Tom Lane provided the

Re: [GENERAL] building extension with large string inserts

2017-07-05 Thread Tom van Tilburg
You are right! I totally forgot about this dollar quoting :) Typically one of those things you will only remember the hard way ;-) Thanks a lot, Tom On Wed, Jul 5, 2017 at 5:08 PM, Tom Lane wrote: > Tom van Tilburg writes: > > I think I

Re: [GENERAL] building extension with large string inserts

2017-07-05 Thread Tom Lane
Tom van Tilburg writes: > 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. $); Sure, but in a dollar-quoted literal you don't need to escape

Re: [GENERAL] building extension with large string inserts

2017-07-05 Thread Tom van Tilburg
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

Re: [GENERAL] building extension with large string inserts

2017-07-05 Thread Tom Lane
Tom van Tilburg 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

[GENERAL] building extension with large string inserts

2017-07-05 Thread Tom van Tilburg
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