7.4的INFORMATION_SCHEMA.Columns视图 [英] 7.4's INFORMATION_SCHEMA.Columns View

查看:68
本文介绍了7.4的INFORMATION_SCHEMA.Columns视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是列视图的一部分,如果你在表格中添加一个数字字段

然后不提供任何长度或精度:


numeric_precision返回为65535

numeric_scale返回为65531

这是您所期望的,创建列意味着什么使用

没有长度或精度,我正在使用pgAdmin创建表格和

列,但表格已创建并且似乎有效。


====================================

CAST(

CASE(当t.typtype =''d''然后t.typbasetype ELSE

a.atttypid END)

当21 / * int2 * /那么16

当23 / * int4 * /那么32

当20 / * int8 * /那么64
WHEN 1700 / * numeric * / THEN((例如t.typtype =''''那么

t.typtypmod ELSE a.atttypmod END - 4)>> 16)& 65535

当700 / * float4 * /那么24 / * FLT_MANT_DIG * /

WHEN 701 / * float8 * / THEN 53 / * DBL_MANT_DIG * /

ELSE null END

AS cardinal_number)

AS numeric_precision,


====================================

CAST(

CASE WHEN t.typtype =''d''那么

情况t.typbasetype IN(21,23, 20)然后0

当t.typbasetype IN(1700)那么(t.typtypmod - 4)&

65535

ELSE null END

ELSE

案例当a.atttypid IN(21,23,20)然后0

当a.atttypid IN(1700)那么( a.atttypmod - 4)& 65535

ELSE null END

END

AS cardinal_number)

AS numeric_scale,



---------------------------(广播结束)--------- ------------------

提示2:您可以使用取消注册命令一次性取消所有列表

(发送取消注册YourEmailAddressHere到 ma*******@postgresql.org

This is part of the Columns View, if you add a numeric field to your table
and don''t provide any Length or Precision then :

numeric_precision is returned as 65535
numeric_scale is returned as 65531

Is this what you''d expect, and what does it mean to create a column with
no Length or Precision, I''m using pgAdmin to create the tables and
columns, but the tables are created and seem to work.

====================================

CAST(
CASE (CASE WHEN t.typtype = ''d'' THEN t.typbasetype ELSE
a.atttypid END)
WHEN 21 /*int2*/ THEN 16
WHEN 23 /*int4*/ THEN 32
WHEN 20 /*int8*/ THEN 64
WHEN 1700 /*numeric*/ THEN ((CASE WHEN t.typtype = ''d'' THEN
t.typtypmod ELSE a.atttypmod END - 4) >> 16) & 65535
WHEN 700 /*float4*/ THEN 24 /*FLT_MANT_DIG*/
WHEN 701 /*float8*/ THEN 53 /*DBL_MANT_DIG*/
ELSE null END
AS cardinal_number)
AS numeric_precision,

====================================

CAST(
CASE WHEN t.typtype = ''d'' THEN
CASE WHEN t.typbasetype IN (21, 23, 20) THEN 0
WHEN t.typbasetype IN (1700) THEN (t.typtypmod - 4) &
65535
ELSE null END
ELSE
CASE WHEN a.atttypid IN (21, 23, 20) THEN 0
WHEN a.atttypid IN (1700) THEN (a.atttypmod - 4) & 65535
ELSE null END
END
AS cardinal_number)
AS numeric_scale,


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

推荐答案

mi ***** *****@mygenerationsoftware.com 写道:
这是列视图的一部分,如果你在表格中添加一个数字字段
并且不提供任何长度或精度然后:
numeric_precision返回为65535
numeric_scale返回为65531
This is part of the Columns View, if you add a numeric field to your table
and don''t provide any Length or Precision then : numeric_precision is returned as 65535
numeric_scale is returned as 65531




是的,这就是你的'' d得到一个没有长度的数字字段

约束。 (我怀疑没有长度限制的varchar将会显示出有趣的内容。)


SQL规范不允许这些类型的无约束长度

因此它没有提供有关在information_schema

视图中显示内容的指导。有什么意见吗?


问候,汤姆小巷


------------------- --------(广播结束)---------------------------

提示1 :订阅和取消订阅命令转到 ma*******@postgresql.org



Yeah, that''s what you''d get for a numeric field with no length
constraint. (I suspect varchar with no length constraint will
display funny as well.)

The SQL spec doesn''t allow unconstrained lengths for these types
so it gives no guidance about what to display in the information_schema
views. Any opinions?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org


mi ********** @ mygenerationsoftware .com 写道:
这是列视图的一部分,如果你在表格中添加一个数字字段
并且不提供任何长度或精度,那么:
numeric_precision返回为65535
numeric_scale返回为65531
This is part of the Columns View, if you add a numeric field to your table
and don''t provide any Length or Precision then : numeric_precision is returned as 65535
numeric_scale is returned as 65531




是的,这就是你用数字字段得到的没有长度

约束。 (我怀疑没有长度限制的varchar将会显示出有趣的内容。)


SQL规范不允许这些类型的无约束长度

因此它没有提供有关在information_schema

视图中显示内容的指导。有什么意见吗?


问候,汤姆小巷


------------------- --------(广播结束)---------------------------

提示1 :订阅和取消订阅命令转到 ma*******@postgresql.org



Yeah, that''s what you''d get for a numeric field with no length
constraint. (I suspect varchar with no length constraint will
display funny as well.)

The SQL spec doesn''t allow unconstrained lengths for these types
so it gives no guidance about what to display in the information_schema
views. Any opinions?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org


2004年6月18日星期五,上午11:42:29 - 0400,

Tom Lane< tg *@sss.pgh.pa。美国>写道:
On Fri, Jun 18, 2004 at 11:42:29 -0400,
Tom Lane <tg*@sss.pgh.pa.us> wrote:

SQL规范不允许这些类型的无约束长度
因此它没有提供有关在information_schema
视图中显示内容的指导。任何意见?

The SQL spec doesn''t allow unconstrained lengths for these types
so it gives no guidance about what to display in the information_schema
views. Any opinions?




使用类型

支持的最大长度可能有一定意义。文件说数字仅限于
1000位数。


如果没有设置该类型的比例,那么NULL可能会使<最有意义的是



---------------------------(广播结束)---------------------------

提示4:不要杀人 - 9''邮政局长



It might make some sense to use the maximum length supported by the type
for the precision. The documentations says that numeric is limited to
1000 digits.

If there isn''t a set scale for the type, then NULL would probably make the
most sense.

---------------------------(end of broadcast)---------------------------
TIP 4: Don''t ''kill -9'' the postmaster


这篇关于7.4的INFORMATION_SCHEMA.Columns视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆