Reputation: 87
Postgres not able to get results queried
opinion_db=# select * from verification_codes;
user | code | id | created_at | updated_at | deleted_at
-----------------+-------+----+-------------------------------+-------------------------------+------------
[email protected] | 12345 | 1 | 2019-09-26 17:40:25.055544+00 | 2019-09-26 17:40:25.063162+00 |
[email protected] | 12345 | 2 | 2019-09-26 17:40:25.055544+00 | 2019-09-26 17:40:25.063162+00 |
(2 rows)
opinion_db=# select * from verification_codes where user = '[email protected]';
user | code | id | created_at | updated_at | deleted_at
------+------+----+------------+------------+------------
(0 rows)
opinion_db=#
The bytes stored are
opinion_db=# SELECT "user"::bytea FROM verification_codes;
user
----------------------------------
\x656464696540676d61696c2e636f6d
\x656464696540676d61696c2e636f6d
What is happening here??
Upvotes: 0
Views: 80
Reputation: 44285
user
refers to the database user. You need "user"
to refer to a column named "user".
You should not use database reserved words as column names, it is confusing, like here.
Upvotes: 3