Postgresql numeric and decimal is automatically rounding offPostgreSQL SELECTs not returning correct result following recovery?DECIMAL and NUMERIC datatype in PostgresCannot log in with default user on Mac 10.10What can I do to monitor “out of shared memory” issues?Postgresql synchronous_commit off and select queriesUnquoting JSON strings; print JSON strings without quotesEquivalent of DB2 function “decimal(numeric expression, precision, scale)” in PostgreSQLConverting float4 to numeric in PostgreSQL is rounding the valuesJava driver dont fire query-start probe in postgres 11PostgreSQL logical replication and partition table

Absconding a company after 1st day of joining

How do I define this subset using mathematical notation?

Is it okay to retroactively change things when running a published adventure?

What impact would a dragon the size of Asia have on the environment?

How would you write do the dialogues of two characters talking in a chat room?

Variation in the spelling of word-final M

Replacing URI when using dynamic hosts in Nginx reverse proxy

Confused about 誘われて (Sasowarete)

Why does the trade federation become so alarmed upon learning the ambassadors are Jedi Knights?

How to draw a gif with expanding circles that reveal lines connecting a non-centered point to the expanding circle using Tikz

Nested-Loop-Join: How many comparisons and how many pages-accesses?

Did the Shuttle's rudder or elevons operate when flown on its carrier 747?

Connect neutrals together in 3-gang box (load side) with 3x 3-way switches?

(algebraic topology) question about the cellular approximation theorem

Possible isometry groups of open manifolds

Can I activate an iPhone without an Apple ID?

Project Euler, problem # 9, Pythagorean triplet

Too many spies!

Why do legislative committees exist?

Is killing off one of my queer characters homophobic?

Construct a pentagon avoiding compass use

Align by center of symbol

How did John Lennon tune his guitar

Waiting time distribution parameters given expected mean



Postgresql numeric and decimal is automatically rounding off


PostgreSQL SELECTs not returning correct result following recovery?DECIMAL and NUMERIC datatype in PostgresCannot log in with default user on Mac 10.10What can I do to monitor “out of shared memory” issues?Postgresql synchronous_commit off and select queriesUnquoting JSON strings; print JSON strings without quotesEquivalent of DB2 function “decimal(numeric expression, precision, scale)” in PostgreSQLConverting float4 to numeric in PostgreSQL is rounding the valuesJava driver dont fire query-start probe in postgres 11PostgreSQL logical replication and partition table






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















CREATE TABLE IF NOT EXISTS ttable (
tcol decimal(9,7)
);


insert into ttable(tcol) values(17.4604786);


the value is getting stored as 17.46



Happens the same if I use decimal/numeric type



I am using

PostgreSQL 11.2 on x86_64-apple-darwin16.7.0, compiled by Apple LLVM version 8.1.0 (clang-802.0.42), 64-bit.


Tool

SQL Workbench/J Build 124 (2018-08-20 22:43)

Java version: 1.8.0_211 (64 bit).


Connection info:

Product Name: PostgreSQL

Product Version: 11.2

Product Info: 11.2

Driver Name: PostgreSQL JDBC Driver

Driver Class: org.postgresql.Driver

Driver Version: 42.2.6

Isolation Level: READ COMMITTED

Workbench DBID: postgresql










share|improve this question









New contributor



Neo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 1





    How are you getting the value? Which client tool?

    – McNets
    8 hours ago












  • @McNets Updated my question with info on tools

    – Neo
    8 hours ago

















2















CREATE TABLE IF NOT EXISTS ttable (
tcol decimal(9,7)
);


insert into ttable(tcol) values(17.4604786);


the value is getting stored as 17.46



Happens the same if I use decimal/numeric type



I am using

PostgreSQL 11.2 on x86_64-apple-darwin16.7.0, compiled by Apple LLVM version 8.1.0 (clang-802.0.42), 64-bit.


Tool

SQL Workbench/J Build 124 (2018-08-20 22:43)

Java version: 1.8.0_211 (64 bit).


Connection info:

Product Name: PostgreSQL

Product Version: 11.2

Product Info: 11.2

Driver Name: PostgreSQL JDBC Driver

Driver Class: org.postgresql.Driver

Driver Version: 42.2.6

Isolation Level: READ COMMITTED

Workbench DBID: postgresql










share|improve this question









New contributor



Neo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 1





    How are you getting the value? Which client tool?

    – McNets
    8 hours ago












  • @McNets Updated my question with info on tools

    – Neo
    8 hours ago













2












2








2








CREATE TABLE IF NOT EXISTS ttable (
tcol decimal(9,7)
);


insert into ttable(tcol) values(17.4604786);


the value is getting stored as 17.46



Happens the same if I use decimal/numeric type



I am using

PostgreSQL 11.2 on x86_64-apple-darwin16.7.0, compiled by Apple LLVM version 8.1.0 (clang-802.0.42), 64-bit.


Tool

SQL Workbench/J Build 124 (2018-08-20 22:43)

Java version: 1.8.0_211 (64 bit).


Connection info:

Product Name: PostgreSQL

Product Version: 11.2

Product Info: 11.2

Driver Name: PostgreSQL JDBC Driver

Driver Class: org.postgresql.Driver

Driver Version: 42.2.6

Isolation Level: READ COMMITTED

Workbench DBID: postgresql










share|improve this question









New contributor



Neo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











CREATE TABLE IF NOT EXISTS ttable (
tcol decimal(9,7)
);


insert into ttable(tcol) values(17.4604786);


the value is getting stored as 17.46



Happens the same if I use decimal/numeric type



I am using

PostgreSQL 11.2 on x86_64-apple-darwin16.7.0, compiled by Apple LLVM version 8.1.0 (clang-802.0.42), 64-bit.


Tool

SQL Workbench/J Build 124 (2018-08-20 22:43)

Java version: 1.8.0_211 (64 bit).


Connection info:

Product Name: PostgreSQL

Product Version: 11.2

Product Info: 11.2

Driver Name: PostgreSQL JDBC Driver

Driver Class: org.postgresql.Driver

Driver Version: 42.2.6

Isolation Level: READ COMMITTED

Workbench DBID: postgresql







postgresql datatypes postgresql-11






share|improve this question









New contributor



Neo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



Neo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 8 hours ago







Neo













New contributor



Neo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 8 hours ago









NeoNeo

134 bronze badges




134 bronze badges




New contributor



Neo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Neo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









  • 1





    How are you getting the value? Which client tool?

    – McNets
    8 hours ago












  • @McNets Updated my question with info on tools

    – Neo
    8 hours ago












  • 1





    How are you getting the value? Which client tool?

    – McNets
    8 hours ago












  • @McNets Updated my question with info on tools

    – Neo
    8 hours ago







1




1





How are you getting the value? Which client tool?

– McNets
8 hours ago






How are you getting the value? Which client tool?

– McNets
8 hours ago














@McNets Updated my question with info on tools

– Neo
8 hours ago





@McNets Updated my question with info on tools

– Neo
8 hours ago










1 Answer
1






active

oldest

votes


















5














It seems to be the default behaviour of SQL Workbench, have a look at this article:



How do I change the resolution or scale of decimal data type on SQL Workbench.



Quoted from the article:




Normally, SQL Workbench doesn't display the decimal data with the full
scale. By default the scale is 2. We can change the scale by the
setting.







Solution



  1. Open Data formatting settings. SQLWorkBench -> Preferences ->Data formatting


  2. Change Decimal digits The default is 2. In this case, it should be at least 11.




And according to SQL Workbench manual about Data formating:




Decimal digits



Define the maximum number of digits which will be displayed for
numeric columns. This only affects the display of the number, not the
storage or retrieval. Internally they are still stored as the DBMS
returned them. To see the internal value, leave the mouse cursor over
the cell. The tool tip which is displayed will contain the number as
it was returned by the JDBC driver. When exporting data or copying it
to the clipboard, the real value will be used.



If this value is set to 0 (zero) values will be display with as many digits as available.




(Bold is mine)






share|improve this answer

























  • you can always double check easily using one of the fiddles - sqlfiddle.com/#!15/bb76b/1

    – SQLRaptor
    8 hours ago











  • @McNets thank you.

    – Neo
    8 hours ago











  • @SQLRaptor thank you for introducing me to sqlfiddle

    – Neo
    8 hours ago











  • I'm glad to help, there are more fiddles like dbfiddle.uk and rextester

    – McNets
    8 hours ago













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "182"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Neo is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f242837%2fpostgresql-numeric-and-decimal-is-automatically-rounding-off%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














It seems to be the default behaviour of SQL Workbench, have a look at this article:



How do I change the resolution or scale of decimal data type on SQL Workbench.



Quoted from the article:




Normally, SQL Workbench doesn't display the decimal data with the full
scale. By default the scale is 2. We can change the scale by the
setting.







Solution



  1. Open Data formatting settings. SQLWorkBench -> Preferences ->Data formatting


  2. Change Decimal digits The default is 2. In this case, it should be at least 11.




And according to SQL Workbench manual about Data formating:




Decimal digits



Define the maximum number of digits which will be displayed for
numeric columns. This only affects the display of the number, not the
storage or retrieval. Internally they are still stored as the DBMS
returned them. To see the internal value, leave the mouse cursor over
the cell. The tool tip which is displayed will contain the number as
it was returned by the JDBC driver. When exporting data or copying it
to the clipboard, the real value will be used.



If this value is set to 0 (zero) values will be display with as many digits as available.




(Bold is mine)






share|improve this answer

























  • you can always double check easily using one of the fiddles - sqlfiddle.com/#!15/bb76b/1

    – SQLRaptor
    8 hours ago











  • @McNets thank you.

    – Neo
    8 hours ago











  • @SQLRaptor thank you for introducing me to sqlfiddle

    – Neo
    8 hours ago











  • I'm glad to help, there are more fiddles like dbfiddle.uk and rextester

    – McNets
    8 hours ago















5














It seems to be the default behaviour of SQL Workbench, have a look at this article:



How do I change the resolution or scale of decimal data type on SQL Workbench.



Quoted from the article:




Normally, SQL Workbench doesn't display the decimal data with the full
scale. By default the scale is 2. We can change the scale by the
setting.







Solution



  1. Open Data formatting settings. SQLWorkBench -> Preferences ->Data formatting


  2. Change Decimal digits The default is 2. In this case, it should be at least 11.




And according to SQL Workbench manual about Data formating:




Decimal digits



Define the maximum number of digits which will be displayed for
numeric columns. This only affects the display of the number, not the
storage or retrieval. Internally they are still stored as the DBMS
returned them. To see the internal value, leave the mouse cursor over
the cell. The tool tip which is displayed will contain the number as
it was returned by the JDBC driver. When exporting data or copying it
to the clipboard, the real value will be used.



If this value is set to 0 (zero) values will be display with as many digits as available.




(Bold is mine)






share|improve this answer

























  • you can always double check easily using one of the fiddles - sqlfiddle.com/#!15/bb76b/1

    – SQLRaptor
    8 hours ago











  • @McNets thank you.

    – Neo
    8 hours ago











  • @SQLRaptor thank you for introducing me to sqlfiddle

    – Neo
    8 hours ago











  • I'm glad to help, there are more fiddles like dbfiddle.uk and rextester

    – McNets
    8 hours ago













5












5








5







It seems to be the default behaviour of SQL Workbench, have a look at this article:



How do I change the resolution or scale of decimal data type on SQL Workbench.



Quoted from the article:




Normally, SQL Workbench doesn't display the decimal data with the full
scale. By default the scale is 2. We can change the scale by the
setting.







Solution



  1. Open Data formatting settings. SQLWorkBench -> Preferences ->Data formatting


  2. Change Decimal digits The default is 2. In this case, it should be at least 11.




And according to SQL Workbench manual about Data formating:




Decimal digits



Define the maximum number of digits which will be displayed for
numeric columns. This only affects the display of the number, not the
storage or retrieval. Internally they are still stored as the DBMS
returned them. To see the internal value, leave the mouse cursor over
the cell. The tool tip which is displayed will contain the number as
it was returned by the JDBC driver. When exporting data or copying it
to the clipboard, the real value will be used.



If this value is set to 0 (zero) values will be display with as many digits as available.




(Bold is mine)






share|improve this answer















It seems to be the default behaviour of SQL Workbench, have a look at this article:



How do I change the resolution or scale of decimal data type on SQL Workbench.



Quoted from the article:




Normally, SQL Workbench doesn't display the decimal data with the full
scale. By default the scale is 2. We can change the scale by the
setting.







Solution



  1. Open Data formatting settings. SQLWorkBench -> Preferences ->Data formatting


  2. Change Decimal digits The default is 2. In this case, it should be at least 11.




And according to SQL Workbench manual about Data formating:




Decimal digits



Define the maximum number of digits which will be displayed for
numeric columns. This only affects the display of the number, not the
storage or retrieval. Internally they are still stored as the DBMS
returned them. To see the internal value, leave the mouse cursor over
the cell. The tool tip which is displayed will contain the number as
it was returned by the JDBC driver. When exporting data or copying it
to the clipboard, the real value will be used.



If this value is set to 0 (zero) values will be display with as many digits as available.




(Bold is mine)







share|improve this answer














share|improve this answer



share|improve this answer








edited 8 hours ago

























answered 8 hours ago









McNetsMcNets

16.7k5 gold badges25 silver badges60 bronze badges




16.7k5 gold badges25 silver badges60 bronze badges












  • you can always double check easily using one of the fiddles - sqlfiddle.com/#!15/bb76b/1

    – SQLRaptor
    8 hours ago











  • @McNets thank you.

    – Neo
    8 hours ago











  • @SQLRaptor thank you for introducing me to sqlfiddle

    – Neo
    8 hours ago











  • I'm glad to help, there are more fiddles like dbfiddle.uk and rextester

    – McNets
    8 hours ago

















  • you can always double check easily using one of the fiddles - sqlfiddle.com/#!15/bb76b/1

    – SQLRaptor
    8 hours ago











  • @McNets thank you.

    – Neo
    8 hours ago











  • @SQLRaptor thank you for introducing me to sqlfiddle

    – Neo
    8 hours ago











  • I'm glad to help, there are more fiddles like dbfiddle.uk and rextester

    – McNets
    8 hours ago
















you can always double check easily using one of the fiddles - sqlfiddle.com/#!15/bb76b/1

– SQLRaptor
8 hours ago





you can always double check easily using one of the fiddles - sqlfiddle.com/#!15/bb76b/1

– SQLRaptor
8 hours ago













@McNets thank you.

– Neo
8 hours ago





@McNets thank you.

– Neo
8 hours ago













@SQLRaptor thank you for introducing me to sqlfiddle

– Neo
8 hours ago





@SQLRaptor thank you for introducing me to sqlfiddle

– Neo
8 hours ago













I'm glad to help, there are more fiddles like dbfiddle.uk and rextester

– McNets
8 hours ago





I'm glad to help, there are more fiddles like dbfiddle.uk and rextester

– McNets
8 hours ago










Neo is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















Neo is a new contributor. Be nice, and check out our Code of Conduct.












Neo is a new contributor. Be nice, and check out our Code of Conduct.











Neo is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Database Administrators Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f242837%2fpostgresql-numeric-and-decimal-is-automatically-rounding-off%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу