Re: The same result for with SPACE and without SPACE

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Wetmore, Matthew (CTR)" <Matthew(dot)Wetmore(at)express-scripts(dot)com>
Cc: mahesh <mahesha_dba(at)yahoo(dot)com>, Scott Ribe <scott_ribe(at)elevated-dev(dot)com>, Mohammed Aslam <hmdaslam97(at)gmail(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, M Sarwar <sarwarmd02(at)outlook(dot)com>
Subject: Re: The same result for with SPACE and without SPACE
Date: 2023-06-15 15:53:20
Message-ID: CAKFQuwY=FN8HBqofgqOE6s1v_nh1QbszWre7_Ryi1qV=MEigJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-advocacy

On Thu, Jun 15, 2023, 08:22 Wetmore, Matthew (CTR) <
Matthew(dot)Wetmore(at)express-scripts(dot)com> wrote:

> 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.
>
>
If anything the inserts themselves should fail in trying to parse the
string to integers. But that works just fine so all three rows have the
same integer output for the different inputs.

David J.

>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2023-06-15 15:56:37 Re: The same result for with SPACE and without SPACE
Previous Message Paul Smith* 2023-06-15 15:48:18 Re: The same result for with SPACE and without SPACE

Browse pgsql-advocacy by date

  From Date Subject
Next Message Scott Ribe 2023-06-15 15:56:37 Re: The same result for with SPACE and without SPACE
Previous Message Paul Smith* 2023-06-15 15:48:18 Re: The same result for with SPACE and without SPACE