pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Enrico Pirozzi <e.pirozzi@nbsgroup.it>
To: pgsql-general@lists.postgresql.org
Subject: Fixed chars
Date: Wed, 28 Mar 2018 11:11:53 +0200
Message-ID: <94af194d-9614-781d-9458-dfda05c86449@nbsgroup.it> (raw)

Hi , I've seen this strange thing.

sitedb=# create table test_tb(codice char(7));
CREATE TABLE
sitedb=# insert into test_tb values('pippo');
INSERT 0 1
sitedb=# select codice || 'a'::char(1),length(codice) from test_tb
  ?column? | length
----------+--------
  pippoa   |      5
(1 row)


On the official documentation

|character(/|n|/)|,|char(/|n|/)|     fixed-length, blank padded

https://www.postgresql.org/docs/10/static/datatype-character.html


Can anyone help me?

Enrico

-- 
Enrico Pirozzi
NBS Group S.r.l.
via Val Tiberina 23/A
63074, San Benedetto del Tronto (AP)
Tel. 0735-7626201





view thread (3+ messages)  latest in thread

Message-ID: <94af194d-9614-781d-9458-dfda05c86449@nbsgroup.it>
Permalink:  ../94af194d-9614-781d-9458-dfda05c86449@nbsgroup.it/
Also on:    postgresql.org/message-id/94af194d-9614-781d-9458-dfda05c86449@nbsgroup.it

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: e.pirozzi@nbsgroup.it
  Subject: Re: Fixed chars
  In-Reply-To: <94af194d-9614-781d-9458-dfda05c86449@nbsgroup.it>
  References: <94af194d-9614-781d-9458-dfda05c86449@nbsgroup.it>

* 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