public inbox for [email protected]
help / color / mirror / Atom feedFrom: Scott Ribe <[email protected]>
To: Wetmore, Matthew (CTR) <[email protected]>
Cc: mahesh <[email protected]>
Cc: Mohammed Aslam <[email protected]>
Cc: [email protected] <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: M Sarwar <[email protected]>
Subject: Re: The same result for with SPACE and without SPACE
Date: Thu, 15 Jun 2023 09:56:37 -0600
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <DM4PR19MB5978EB964FA1C7B55FFCB02DD35AA@DM4PR19MB5978.namprd19.prod.outlook.com>
<DM4PR19MB59782360E0C452810D70CBE8D35AA@DM4PR19MB5978.namprd19.prod.outlook.com>
<[email protected]>
<DM4PR19MB59784B518F25D2C2292CA3FBD35AA@DM4PR19MB5978.namprd19.prod.outlook.com>
<[email protected]>
<[email protected]>
<[email protected]>
<CAJXhg9ByRV9QPVcW5MPi2c20g948Oxt8qU1DrcVb51fFgTEj2A@mail.gmail.com>
<[email protected]>
<[email protected]>
Nobody's kicking you out of any group. Someone requested themselves to be removed, with a typo that made it ambiguous.
The original question had nothing to do with INT, it was behavior of CHAR and trailing spaces.
> 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?)
Yes. Or more precisely, it is because when a string is cast to an int, leading and trailing spaces are ignored. The alternative would be to raise an error, as 'an integer plus some spaces' is not an integer...
> select c2 from matt_test2 where c2 = '123'
> -- 1 rows returned.
Yes, for TEXT column, which behaves the same as VARCHAR. Also 1 row for:
select c2 from matt_test2 where c2 = '123 '
But 2 rows returned for CHAR column, as inserting '123' and '123 ' into CHAR(n) results in the same value being inserted. And also 2 rows returned for:
select c2 from matt_test2 where c2 = '123 '
^^^ which was the original question
view thread (22+ messages) latest in thread
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: The same result for with SPACE and without SPACE
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox