Re: Using compression on TCP transfer

Поиск
Список
Период
Сортировка
От Andrus
Тема Re: Using compression on TCP transfer
Дата
Msg-id 7C033DCE8AD84649B95C5B367D6063B3@dell2
обсуждение исходный текст
Ответ на Re: Using compression on TCP transfer  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: Using compression on TCP transfer
Список pgsql-general
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.



В списке pgsql-general по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Why there is 30000 rows is sample
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Why there is 30000 rows is sample