473,654 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

7.4's INFORMATION_SCH EMA.Columns View

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_precisi on 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_precisi on,

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

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 YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #1
14 3900
mi**********@my generationsoftw are.com writes:
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_precisi on is returned as 65535
numeric_scale is returned as 65531


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_sch ema
views. Any opinions?

regards, tom lane

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

Nov 23 '05 #2
mi**********@my generationsoftw are.com writes:
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_precisi on is returned as 65535
numeric_scale is returned as 65531


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_sch ema
views. Any opinions?

regards, tom lane

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

Nov 23 '05 #3
On Fri, Jun 18, 2004 at 11:42:29 -0400,
Tom Lane <tg*@sss.pgh.pa .us> wrote:

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


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

Nov 23 '05 #4
On Fri, Jun 18, 2004 at 11:42:29 -0400,
Tom Lane <tg*@sss.pgh.pa .us> wrote:

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


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

Nov 23 '05 #5
Ah yes, is that in pg_types, good idea, I might override that after I make
the query.
On Fri, Jun 18, 2004 at 11:42:29 -0400,
Tom Lane <tg*@sss.pgh.pa .us> wrote:

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


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 7: don't forget to increase your free space map settings

Nov 23 '05 #6
Ah yes, is that in pg_types, good idea, I might override that after I make
the query.
On Fri, Jun 18, 2004 at 11:42:29 -0400,
Tom Lane <tg*@sss.pgh.pa .us> wrote:

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


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 7: don't forget to increase your free space map settings

Nov 23 '05 #7
mi**********@my generationsoftw are.com writes:
I noticed that there is no INFORMATION_SCH EMA.Indexes ? isn't there
supposed to be one.


Nope. Indexes are not a concept used in the SQL spec at all (they
consider 'em an implementation detail), so they'd hardly want to
standardize a view to describe 'em.

You can look at the constraints views to find out about unique and
primary key constraints, which are implemented by indexes in PG.
But that won't tell you about indexes made by CREATE INDEX.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #8
mi**********@my generationsoftw are.com writes:
I noticed that there is no INFORMATION_SCH EMA.Indexes ? isn't there
supposed to be one.


Nope. Indexes are not a concept used in the SQL spec at all (they
consider 'em an implementation detail), so they'd hardly want to
standardize a view to describe 'em.

You can look at the constraints views to find out about unique and
primary key constraints, which are implemented by indexes in PG.
But that won't tell you about indexes made by CREATE INDEX.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #9
>>> The SQL spec doesn't allow unconstrained lengths for these types
so it gives no guidance about what to display in the information_sch ema
views. Any opinions?


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


After more thought I like returning NULL for both precision and scale in
the case of unconstrained numeric columns. Any other value is
arbitrary. In particular, the 1000 cited in the docs is *very*
arbitrary, and I don't think it actually constrains what you can store,
only what you can declare as a column precision. [tries it...] Yup,
I can store "power(10.0 , 10000)" in an unconstrained numeric column.
It seems to fail around 10^140000 but I'm not sure where that limit
is coming from exactly...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6924
by: Pachydermitis | last post by:
Hi I need to see all the indexes in a database. The ID has dbo rights to the database, but not to the master. I can't see anything in INFORMATION_SCHEMA.CHECK_CONSTRAINTS or INFORMATION_SCHEMA.KEY_COLUMN_USAGE An sa ID for the master sees everything however. Thanks for your help Pachydermitis
3
8945
by: Tina Harris | last post by:
I ran the following query in Query Analyzer for a 7 column table. SELECT c.name,c.colid FROM syscolumns c WHERE c.id=925962375 ORDER BY c.colid The results were: I_CSD 1 X_STE_XML 2 I_USR_LCK 4 T_CRT_RCD 5
3
10773
by: Dave Sisk | last post by:
Hi Folks: I'm a little new to SQLServer, so please pardon my ignorance! I've found the INFORMATION_SCHEMA views for TABLES, COLUMNS, and TABLE_CONSTRAINTS. I'm looking for the views that will give me the list of columns by constraint. For instance, if Table1 has a unique key called Table1_UK01, I can find that under INFORMATION_SCHEMA.TABLE_CONSTRAINTS. But I also need to know the
0
545
by: mike.griffin | last post by:
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.
0
2621
by: BB | last post by:
Hi There, just moved over from SQL Server to mySQL and finding my way about. In SQL Server there was a way of retrieving (and setting) metaproperties for columns and tables. The closest I see to this is the TABLES.table_comment COLUMNS.column_comment fields in the INFORMATION_SCHEMA 'Database'. How do you set these values? Seems like you cannot amend values within these tables. I am using version 5.0.27.
2
2256
by: parkc | last post by:
How do you change the order of key columns in a primary key and view the difference between two tables that have the same name? For example, table x has a primary key called pk_x. PK_x contains two key columns x and y in the order 1 and 2 now I want to change it so that columns x and y are 2 and 1. How do I do that?
1
2108
by: Shrek | last post by:
if I select character_maximum_length from INFORMATION_SCHEMA.COLUMNS if returns -1 on columns that are defined as varchar(max) is this normal???
8
5095
by: Sham | last post by:
I am trying to perform the following query on a table that has been indexed using Full Text Search. The table contains multiple columns than have been indexed. (Below, all xml columns are indexed). dbo.maintable(ProfileID int pk) dbo.fts_table(ProfileID int pk fk, col1 xml, col2 xml, col3 xml) I want to perform a query that will return any rows that contain ‘x’ and ‘y’ in any columns. I.e. ‘x’ could be in col1 and ‘y’ could be in
2
3891
by: amit2781 | last post by:
Hi, I have created 4 tables in 'amit' database and then I deleted them. Still I able to get information about the table_schema for the table deleted. After drop table when I fire a query for table_schema from information_schema.tables it will give me result as 'amit'. I didn't understand why it is happnes. See the below steps done. mysql> use amit; mysql> show tables; +----------------+
0
8376
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8489
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.