I would like to know if it is possible to execute a Trigger when a SELECT is performed in a certain table, for example:
CREATE TABLE IF NOT EXISTS "Conversa" (
"idConversa" SERIAL NOT NULL,
"idEmissorConversa" INT NOT NULL,
"idReceptorConversa" INT NOT NULL,
"mensagemConversa" VARCHAR(250) NOT NULL,
"statusConversa" INT NOT NULL,
"horaConversa" TIMESTAMP NOT NULL,
PRIMARY KEY ("idConversa")
This is the table, the concept of it is to create a Chat, where I will save the ID of the person who sent the message, the ID of the person who received the message, the statusConversa would be the item I wanted to change with Trigger, because:
statusConversa = 0 -- Significa que a mensagem não foi lida(carregada)
statusConversa = 1 -- Significa que a mensagem foi lida(carregada)
Then, when a SELECT is carried out in this message, the Trigger should change the StatusConversa to 1. So that later, when checking via AJAX if there is a new message, it will fetch messages with statusConversa = 0. >