如何在 Postgres 中获取序列名称列表? [英] How to get list of sequence names in Postgres?
本文介绍了如何在 Postgres 中获取序列名称列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取 Postgres 中的序列名称列表.
I want to get the list of sequence names in Postgres.
在 Oracle 中,我可以使用:
In Oracle, I can use:
select sequence_name
from user_sequences
但是在 Postgres 中,当我使用该语句时,它总是抛出错误:not found user_sequences.
But in Postgres when I use that statement it always throws the error: not found user_sequences.
如何在 Postgres 中执行此操作?
How can I do this in Postgres?
推荐答案
SELECT c.relname FROM pg_class c WHERE c.relkind = 'S';
或者尝试以 psql -U username -E
后跟 \ds
的方式运行 psql.这也会显示用于生成结果的查询.
SELECT c.relname FROM pg_class c WHERE c.relkind = 'S';
Or trying running psql as psql -U username -E
followed by \ds
. This will show you the query that was been used to generate the result as well.
这篇关于如何在 Postgres 中获取序列名称列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文