From: Andrus <kobruleht2@hot.ee>
To: Laurenz Albe <laurenz.albe@cybertec.at>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Using compression on TCP transfer
Date: Sat, 4 Apr 2020 11:08:56 +0300
Message-ID: <7C033DCE8AD84649B95C5B367D6063B3@dell2> (raw)
In-Reply-To: <1e7536de1cb9e1097d1c8faf07a08bf66d8eeead.camel@cybertec.at>
References: <45AE45823FB844ED80186DE14DCC5B14@dell2>
<b50c974b0d423dd7e6c500b59a31895d4278efa9.camel@cybertec.at>
<5DB1E9D2ADDB4BA0ABDF602235234BCC@dell2>
<1e7536de1cb9e1097d1c8faf07a08bf66d8eeead.camel@cybertec.at>
Hi!
>> In case of varchar field values will appear in database sometimes with
>> trailing spaces and sometimes without.
>> This requires major application re-design which much is more expensive than
>> continuing using char fields.
>A simple BEFORE INSERT OR UPDATE trigger would take care of that.
Changing char to varchar will break commands where trailing space is used in comparison.
For example query
create table test ( test char(10) );
insert into test values ('test');
select * from test where test ='test '; -- note trailing space
does not return data anymore if your recommendation is used:
create table test ( test varchar );
insert into test values ('test');
select * from test where test ='test '; -- note trailing space
In production 'test ' is query parameter coming from application with possible trailing space(s).
Adding trigger does not fix this.
How to fix this without re-writing huge number of sql commands?
Andrus.
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: kobruleht2@hot.ee, laurenz.albe@cybertec.at
Subject: Re: Using compression on TCP transfer
In-Reply-To: <7C033DCE8AD84649B95C5B367D6063B3@dell2>
References: <45AE45823FB844ED80186DE14DCC5B14@dell2> <b50c974b0d423dd7e6c500b59a31895d4278efa9.camel@cybertec.at> <5DB1E9D2ADDB4BA0ABDF602235234BCC@dell2> <1e7536de1cb9e1097d1c8faf07a08bf66d8eeead.camel@cybertec.at> <7C033DCE8AD84649B95C5B367D6063B3@dell2>
* 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