1

This works as expected,

\set x '''2\n3'''

but this doesn't

\set x '''2
3'''

Is there a workaround for later example so I don't have to use \n instead of newline?

asked Jan 11, 2016 at 10:08
2
  • psql commands are oneliners (including \copy, being the only one that annoys me regularly). If you tell us the purpose of this, we might come up with a better idea. Commented Jan 11, 2016 at 15:40
  • @dezso I would like to paste some text into psql which can be later used for queries. \gset is probably able to handle this. Commented Jan 12, 2016 at 20:17

1 Answer 1

3

To answer my own question, the \gset command should be used for multiline variable content,

select '''2
3''' x \gset
answered Jan 15, 2016 at 14:14

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.