参考:https://www.postgresql.org/docs/current/static/app-psql.html
postgres=# select * from tab_lei_1;
c1 | c2
----+----
(0 rows)
postgres=# \set abc 'tab_lei_1'
postgres=# select * from :abc;
c1 | c2
----+----
(0 rows)
postgres=#
本文通过实例展示了如何使用psql客户端执行SQL查询,并介绍了如何设置变量并在查询中引用这些变量的方法。
参考:https://www.postgresql.org/docs/current/static/app-psql.html
postgres=# select * from tab_lei_1;
c1 | c2
----+----
(0 rows)
postgres=# \set abc 'tab_lei_1'
postgres=# select * from :abc;
c1 | c2
----+----
(0 rows)
postgres=#
2905
3983
1680
1904