How to add time-related triggers in PostgreSQL?

Regarding how: I am confused and powerless:

>After setting up the database, add a trigger to the postgresql database, that is, add a trigger by clicking a hyperlink
>Write a trigger function to delete a specific row one week after the trigger is written.

For clarity, this is a sequence of events

>Administrator passed The html page generated by php to view the entries in the database.
>The administrator clicks on the “Approve” hyperlink next to the database entry.
>This will create a trigger in the db to delete that specific row after 1 week .

I need help with step 3

Another way is to set a trigger on the table so that when a row is inserted, a new trigger will be created which will Check the value of the “Approved” column of the row. When the administrator clicks “Approve” in the html page, the word “Yes” will be inserted into the “Approved” column of the row. The trigger will detect this and Add a new trigger to delete the row in a week?

You can tell me, I’m really not sure which way and how to do this, so any feedback would be greatly appreciated. Thanks.

Simple: Store the expiration date of the URL in your database, and only retrieve the currently valid records in your choice (you can use this view), Delete expired URLs from time to time.

But you cannot use triggers. pgAgent or cron can be used to start the cleanup process.

For how : I feel confused and helpless:

>After setting up the database, add a trigger to the postgresql database, that is, add a trigger by clicking the hyperlink.
>Write a trigger function so that you can write Delete a specific row one week after entering the trigger.

For clarity, this is a sequence of events

>The administrator views the entries in the database through the html page generated by php.
>The administrator clicks on the “Approve” hyperlink next to the database entry.
>This will create a trigger in the db to delete that specific row after 1 week.

I need step 3. Help

Another way is to set a trigger on the table to create a new trigger when inserting a row, which will check the value of the “Approved” column of the row. When When the administrator clicks on “Approve” in the html page, the word “Yes” will be inserted into the “Approved” column of the row. The trigger will detect this and add a new trigger to delete the row in a week?

You can tell me, I’m really not sure which way to do this and how to do this, so any feedback will be greatly appreciated. Thanks.

Simple: Store the expiration date of the URL in your database, only retrieve the currently valid record in your selection (you can use this view), and delete the expired URL from time to time.

But you cannot use triggers. pgAgent or cron can be used to start the cleanup process.

Leave a Comment

Your email address will not be published.