Defining multi-line strings in psql

前端 未结 1 1245
春和景丽
春和景丽 2021-02-20 04:34

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 04:54

    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)
提交回复
热议问题