The same result for with SPACE and without SPACE

Поиск
Список
Период
Сортировка
От Wetmore, Matthew (CTR)
Тема The same result for with SPACE and without SPACE
Дата
Msg-id 3f21240f59a54f96898886f2c9189cf3@express-scripts.com
обсуждение исходный текст
Ответ на Re: The same result for with SPACE and without SPACE  (mahesh <mahesha_dba@yahoo.com>)
Ответы Re: The same result for with SPACE and without SPACE  (Paul Smith* <paul@pscs.co.uk>)
Re: The same result for with SPACE and without SPACE  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: The same result for with SPACE and without SPACE  (Scott Ribe <scott_ribe@elevated-dev.com>)
Список pgsql-admin

Before you kick me out of the group, can you please explain.

 

I thought the orig issue was that purposefully spaces/whitespace are being ignored (or not ignored.) in the select.  Maybe there was an email in the middle that I missed.

 

create table matt_test (c1 int)

 

insert into matt_test  values ('123')

 

insert into matt_test  values (' 123')

 

insert into matt_test values ('123 ')

 

select c1 from matt_test where c1 = '123'

-- all 3 rows returned.

 

Is it expected behavior that all 3 rows would be returned (because the space isn’t an INT?)

 

Works as I would expect with TEXT

 

create table matt_test2 (c2 text)

 

insert into matt_test2  values ('123')

 

insert into matt_test2  values (' 123')

 

insert into matt_test2  values ('123 ')

 

select c2 from matt_test2 where c2 = '123'

-- 1 rows returned.

 

 

From: mahesh <mahesha_dba@yahoo.com>
Sent: Thursday, June 15, 2023 7:12 AM
To: Scott Ribe <scott_ribe@elevated-dev.com>; Mohammed Aslam <hmdaslam97@gmail.com>; pgsql-admin@lists.postgresql.org
Cc: Wetmore, Matthew (CTR) <Matthew.Wetmore@express-scripts.com>; Tom Lane <tgl@sss.pgh.pa.us>; M Sarwar <sarwarmd02@outlook.com>
Subject: [EXTERNAL] Re: The same result for with SPACE and without SPACE

 

Kindly remove from from the group..

 

On Thursday, June 15, 2023 at 08:44:58 AM CDT, Mohammed Aslam <hmdaslam97@gmail.com> wrote:

 

 

Kindly remove from here

 

On Thu, 15 Jun, 2023, 7:09 pm Scott Ribe, <scott_ribe@elevated-dev.com> wrote:

> On Jun 15, 2023, at 7:08 AM, Wetmore, Matthew (CTR) <Matthew.Wetmore@express-scripts.com> wrote:
>
> I can reproduce this with a INT

?

When casting string to integer, trailing spaces do not cause an exception. When casting integer to char(n), the string will be blank padded.

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

Предыдущее
От: OracleDba OracleDba
Дата:
Сообщение: is there pgadmin interface with Hashicorp Vault or command line interface to use master password and update password repository
Следующее
От: Paul Smith*
Дата:
Сообщение: Re: The same result for with SPACE and without SPACE