3
Let’s imagine the following scenario:
CREATE TABLE invalido (
ds_valor character varying(255)
)
CREATE TABLE email (
email character varying(255)
)
now I need a trigger
that every time I run a UPDATE
or INSERT
on the table email
check if the value is in the table invalido
, if you are then you should replace what would be inserted in the table email
for invalid email.
syntax error at or near "UPDATE", removing the UPDATE wheel...
– David Schrammel
tries to put BEFORE INSERT OR UPDATE and confirms if it worked, please
– Sorack
Approves then ^^
– Sorack
@Sorack I know this post is a little old but I can apply this idea if I have the following scenario, I have a table 01 with id_client and client name_table and the table 02 also with id_client and client name_table, i need that if I change the record of the column name_client in table 01 the record that has the same id_client in table 02 change the record name_client too, it is possible?
– R.Santos
@R.Santos good question. You would have to do a search to see if you can make changes in another table with
trigger
in thePostgres
. But you can open a question and we’ll take a look– Sorack
I opened one like this: https://answall.com/questions/204026/trigger-que-actualizze-registro-em-uma-tabela if you happen to find any ideas I thank you, it doesn’t have to be necessarily via Rigger, if you have any idea that I can do this is already a way :)
– R.Santos