postgresql数据库中,查询一个字段允许的最大长度的SQL语句怎么写?_百...

发布网友 发布时间:2022-04-23 00:45

我来回答

1个回答

热心网友 时间:2022-04-10 07:49

对于character类型和character
varying类型的字段,也可以用一下语句查询。
SELECT
attname
as
"name",
typname
as
"type",
atttypmod
-
4
as
"size"
FROM
pg_class
AS
a
LEFT
OUTER
JOIN
pg_attribute
AS
b
ON
(b.attrelid
=
a.oid)
LEFT
OUTER
JOIN
pg_type
AS
c
ON
(b.atttypid
=
c.oid)
where
a.relname
=
'<tablename>'
and
attname='<fieldname>'
and
b.attstattarget
=
-1
order
by
attnum;
希望对你有所帮助。

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com