Fix: Usar clock_timestamp() en trigger updated_at para garantizar timestamps únicos
- Cambiar now() por clock_timestamp() en función set_updated_at() - now() retorna el timestamp del inicio de la transacción - clock_timestamp() retorna el timestamp actual del sistema - Garantiza que cada UPDATE tenga un timestamp diferente - Mejora la precisión para auditoría de cambios
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
CREATE OR REPLACE FUNCTION set_updated_at()
|
||||
RETURNS trigger LANGUAGE plpgsql AS $$
|
||||
BEGIN
|
||||
NEW.updated_at := now();
|
||||
NEW.updated_at := clock_timestamp();
|
||||
RETURN NEW;
|
||||
END $$;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user