Thread: Wired behaviour from SELECT

Wired behaviour from SELECT

From
Arbol One
Date:


Two different SELECT sql statement don't behave the same way.
The below sql statement produces the right output
SELECT nickname, password FROM password WHERE id='0938105618107N1';
  nickname   | password
-------------+----------
 Piccard@@21 |  Arbol
(1 row)
However, if this sql statement produces the wrong output
SELECT nickname, password FROM password WHERE nickname='Arbol';
 nickname | password
----------+----------
(0 rows)
What am I doing wrong?

Re: Wired behaviour from SELECT

From
"David G. Johnston"
Date:
On Fri, Nov 22, 2024 at 1:07 PM Arbol One <arbolone@hotmail.ca> wrote:
The below sql statement produces the right output
SELECT nickname, password FROM password WHERE id='0938105618107N1';
  nickname   | password
-------------+----------
 Piccard@@21 |  Arbol
(1 row)
However, if this sql statement produces the wrong output
SELECT nickname, password FROM password WHERE nickname='Arbol';
 nickname | password
----------+----------
(0 rows)
What am I doing wrong?
Naming a column in your table the same name as the table is problematic generally.  As for the query, if they are both intended to return the same row the value Arbol is in the password column, not the nickname column.  You seem to have reversed the data for the two columns.

David J.

Re: Wired behaviour from SELECT

From
Ron Johnson
Date:
On Fri, Nov 22, 2024 at 3:07 PM Arbol One <arbolone@hotmail.ca> wrote:

Two different SELECT sql statement don't behave the same way.
The below sql statement produces the right output
SELECT nickname, password FROM password WHERE id='0938105618107N1';
  nickname   | password
-------------+----------
 Piccard@@21 |  Arbol
(1 row)
Storing passwords in plain text is the Worst Possible Security Practice Ever Conceived.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

Re: Wired behaviour from SELECT

From
David Mullineux
Date:
Instead of nickname you probably want tontet where password=`Arbol'  ..  or am.i.missong something ?.

On Fri, 22 Nov 2024, 20:13 David G. Johnston, <david.g.johnston@gmail.com> wrote:
On Fri, Nov 22, 2024 at 1:07 PM Arbol One <arbolone@hotmail.ca> wrote:
The below sql statement produces the right output
SELECT nickname, password FROM password WHERE id='0938105618107N1';
  nickname   | password
-------------+----------
 Piccard@@21 |  Arbol
(1 row)
However, if this sql statement produces the wrong output
SELECT nickname, password FROM password WHERE nickname='Arbol';
 nickname | password
----------+----------
(0 rows)
What am I doing wrong?
Naming a column in your table the same name as the table is problematic generally.  As for the query, if they are both intended to return the same row the value Arbol is in the password column, not the nickname column.  You seem to have reversed the data for the two columns.

David J.

Re: Wired behaviour from SELECT

From
Arbol One
Date:

Oops!
I am putting too many hours in front of the computer, better take a break
😳

On 2024-11-22 3:12 p.m., David G. Johnston wrote:
On Fri, Nov 22, 2024 at 1:07 PM Arbol One <arbolone@hotmail.ca> wrote:
The below sql statement produces the right output
SELECT nickname, password FROM password WHERE id='0938105618107N1';
  nickname   | password
-------------+----------
 Piccard@@21 |  Arbol
(1 row)
However, if this sql statement produces the wrong output
SELECT nickname, password FROM password WHERE nickname='Arbol';
 nickname | password
----------+----------
(0 rows)
What am I doing wrong?
Naming a column in your table the same name as the table is problematic generally.  As for the query, if they are both intended to return the same row the value Arbol is in the password column, not the nickname column.  You seem to have reversed the data for the two columns.

David J.

--
ArbolOne ™
Using Fire Fox and Thunderbird.
ArbolOne is composed of students and volunteers dedicated to providing free services to charitable organizations.
ArbolOne's development on Java, PostgreSQL, HTML and Jakarta EE is in progress [ í ]

Re: Wired behaviour from SELECT

From
Arbol One
Date:

Yes! Absolutely true. Thanks for the advice 🙂

On 2024-11-22 3:36 p.m., Ron Johnson wrote:
On Fri, Nov 22, 2024 at 3:07 PM Arbol One <arbolone@hotmail.ca> wrote:

Two different SELECT sql statement don't behave the same way.
The below sql statement produces the right output
SELECT nickname, password FROM password WHERE id='0938105618107N1';
  nickname   | password
-------------+----------
 Piccard@@21 |  Arbol
(1 row)
Storing passwords in plain text is the Worst Possible Security Practice Ever Conceived.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
--
ArbolOne ™
Using Fire Fox and Thunderbird.
ArbolOne is composed of students and volunteers dedicated to providing free services to charitable organizations.
ArbolOne's development on Java, PostgreSQL, HTML and Jakarta EE is in progress [ í ]