Defining multi-line strings in psql

前端 未结 1 1442
执念已碎
执念已碎 2021-02-20 04:23

I would like to paste

  123
  456
  789

into psql and to store multi-line string in some variable (ie. :str) for late

相关标签:
1条回答
  • 2021-02-20 05:08

    A little clunky, but in version 9.3 and up, you can do it with \gset in conjunction with a dollar-quoted literal:

    SELECT
    $$123
    456
    789$$ AS str \gset
    
    0 讨论(0)
提交回复
热议问题