From: | Killian Driscoll <killiandriscoll(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Query to return data types |
Date: | 2016-12-07 09:50:55 |
Message-ID: | CAL64pZNFbXjBWW1wjSyfu9c6weq7astV6LsixSWnkr6VdJXKMg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On 7 December 2016 at 10:36, Killian Driscoll <killiandriscoll(at)gmail(dot)com>
wrote:
> I want to query the precision and scale of all columns of numeric types. I
> see here
> <http://dba.stackexchange.com/questions/75015/query-to-return-output-column-names-and-data-types-of-a-query-table-or-view> to
> use information_schema.columns; I have done this, and for one schema (my
> db has three schemas) it works using:
>
> SELECT column_name, data_type, numeric_scale, numeric_precision,
> numeric_precision_radix
> FROM information_schema.columns
> WHERE table_name = 't1'
> ORDER BY ordinal_position;
>
> This returns
>
> "x";"numeric";10;20;10
> "y";"numeric";10;20;10
> "z";"numeric";4;10;10
>
> If I query a table on another schema using:
>
> SELECT column_name, data_type, numeric_scale, numeric_precision,
> numeric_precision_radix
> FROM information_schema.columns
> WHERE table_name = 't1b'
> ORDER BY ordinal_position;
>
> This returns
>
> "area";"numeric";;;10
> "latitude";"numeric";;;10
> "longitude";"numeric";;;10
>
> even though there should be an output for scale and precision.
>
> How can I correctly query this?
>
I see what I did: I just queried where I had already declared the precision
and scale.
What I actually want is to see is: which columns contain data with values
that contain decimal points, and the max precision and scale of these
values.
>
>
> Killian
>
From | Date | Subject | |
---|---|---|---|
Next Message | DrakoRod | 2016-12-08 03:49:00 | Trigger before or after update that change row to another child table of a partitioned table |
Previous Message | Killian Driscoll | 2016-12-07 09:36:55 | Query to return data types |