You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ccDangJianExam/Doc/ OpenGauss常用命令.txt

33 lines
735 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 查询数据库相应用户dsideal的所有序列
SELECT
*
FROM
pg_class
WHERE
relowner = (SELECT usesysid FROM pg_user WHERE usename = 'dsideal')
AND relkind = 'S'
# 查询所有表名字默认schema名字是public
SELECT
tablename
FROM
pg_tables
WHERE
schemaname = 'public'
# 查询已知表名tableName的所有字段的字段名、类型、是否为空、注释
SELECT
A.attname AS NAME,
format_type(A.atttypid, A.atttypmod) AS TYPE,
A.attnotnull AS NOTNULL,
col_description(A.attrelid, A.attnum) AS COMMENT
FROM
pg_class AS C,
pg_attribute AS A
WHERE
C.relname = 'tableName'
AND A.attnum > 0
AND A.attrelid = C.oid
# 需要注意修改一下
mysql:ifnull <--> pgsql:COALESCE