From: soumik.bhattacharjee@kpn.com
To: Anssi.Kanninen@digia.com
To: pgsql-admin@postgresql.org
To: nidhig631@gmail.com
Subject: RE: Data Type to store Leading Zero(0)
Date: Wed, 20 Jan 2021 11:32:13 +0000
Message-ID: <49825a434d264d58b4a02e0b97925272@kpn.com> (raw)
In-Reply-To: <HE1PR02MB32595FC547B458B041E3992999A20@HE1PR02MB3259.eurprd02.prod.outlook.com>
References: <c77968e8e35a4e9d8f68c2683ae1b807@kpn.com>
<CAAbUf+FEtZC6g6J_sM9XqkmRtJcTHwfTCQbDBmqF5WM__1aTbw@mail.gmail.com>
<HE1PR02MB32595FC547B458B041E3992999A20@HE1PR02MB3259.eurprd02.prod.outlook.com>
Thanks , will test this both as need to check the entity mappings from my Java spring boot.
From: Kanninen Anssi EXT <Anssi.Kanninen@digia.com>
Sent: woensdag 20 januari 2021 12:29
To: pgsql-admin@postgresql.org
Subject: RE: Data Type to store Leading Zero(0)
Hi,
How about storing the actual number in TEXT column and adding a separate INT primary key column where you either copy the number or use it as a generated column?
Or, if you actually want to include the leading zeroes in the primary key, how about two-column primary key like this:
number_of_leading_zeroes smallint,
the_number integer
So, the number "0005556879" would become a primary key (3, 5556879).
Sincerely,
Anssi Kanninen
From: Nidhi Gupta <nidhig631@gmail.com<mailto:nidhig631@gmail.com>>
Sent: keskiviikko 20. tammikuuta 2021 13.20
To: soumik.bhattacharjee@kpn.com<mailto:soumik.bhattacharjee@kpn.com>
Cc: pgsql-admin@postgresql.org<mailto:pgsql-admin@postgresql.org>
Subject: Re: Data Type to store Leading Zero(0)
Use datatype smallint(1) for storing zero or use Boolean datatype.
On Wed, Jan 20, 2021, 4:43 PM <soumik.bhattacharjee@kpn.com<mailto:soumik.bhattacharjee@kpn.com>> wrote:
Hello Experts,
As per business needs we need to store Zero(0) in primary key column of table with this kind of value --> 07******** with applications written in Java microservices.
We are not able to use numeric data type as it trims the Zero value in leading, but it’s also a performance impact if we define varchar in the data type.
Please suggest.
Thanks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: soumik.bhattacharjee@kpn.com, Anssi.Kanninen@digia.com, nidhig631@gmail.com
Subject: RE: Data Type to store Leading Zero(0)
In-Reply-To: <49825a434d264d58b4a02e0b97925272@kpn.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox