0

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??

1
  • What do you get for SELECT "user"::bytea FROM verification_codes;? Commented Sep 26, 2019 at 17:59

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.