RE: Data Type to store Leading Zero(0) - Mailing list pgsql-admin

From
Subject RE: Data Type to store Leading Zero(0)
Date
Msg-id 7bb92c536d544e818562bfe713eac363@kpn.com
Whole thread Raw
In response to Re: Data Type to store Leading Zero(0)  (Nidhi Gupta <nidhig631@gmail.com>)
Responses Re: Data Type to store Leading Zero(0)  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Data Type to store Leading Zero(0)  (Laurenz Albe <laurenz.albe@cybertec.at>)
Re: Data Type to store Leading Zero(0)  (Paul Smith <paul@pscs.co.uk>)
Re: Data Type to store Leading Zero(0)  (Imre Samu <pella.samu@gmail.com>)
List pgsql-admin

Thanks for your mail.

 

  • smallint will be out of range for this  due to number of bytes and ideally its behaving same way as any ***int data type.
  • Boolean is not possible as this is phone number.

 

Please suggest

 

Thanks..

 

 

From: Nidhi Gupta <nidhig631@gmail.com>
Sent: woensdag 20 januari 2021 12:20
To: Bhattacharjee, Soumik <soumik.bhattacharjee@kpn.com>
Cc: 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> 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

 

pgsql-admin by date:

Previous
From: Jayson Hreczuck
Date:
Subject: Re: Logical replication Replica identity
Next
From: "David G. Johnston"
Date:
Subject: Re: Data Type to store Leading Zero(0)