Answer the question
In order to leave comments, you need to log in
How to change boolean value in db after certain time?
Hello everyone, I can’t figure out how to automatically change the value in the postgresql database, for example, change from true to false after 24 hours. I will be very grateful)
Answer the question
In order to leave comments, you need to log in
well, in general, there is a table with products and I planned to make such a functionality that will show information that this is a recently added product, and then automatically change its value after a certain time, well, the first thing that came to my mind was to do true, false)
SELECT id, (created_at > (current_timestamp - '1 day'::interval)) as "is_newly_added" FROM goods
99.99% sure you don't need it. For at least a hundred other users who have asked the same question here, it was solved in a different way.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question