Difference between set, \\set and \\pset in psql

纵饮孤独 提交于 2019-12-05 01:29:42

Basically correct. The important difference is that SET is an SQL command while the other two are psql meta-commands - indicated by the prefixed \.

  • SET is an SQL command to change run-time parameters. It is executed on the server and has nothing to do with psql per se.

  • \set is a psql meta-command and, per documentation:

    Sets the psql variable name to value [...]

    Note: This command is unrelated to the SQL command SET.

  • \pset is another psql meta-command. Per documentation:

    This command sets options affecting the output of query result tables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!