How to avoid UPDATE on same data in table ?

2020-02-02 Thread Condor
Hello, I'm using PostgreSQL 12.1 and trying to avoid update on table when data is the same. I read somewhere if UPDATE is with the same data SQL server on system level does not do update on table but don't know if that is true or not. If that is not true I do: First I create a function tha

Re: How to avoid UPDATE on same data in table ?

2020-02-02 Thread Andreas Kretschmer
Am 02.02.20 um 10:24 schrieb Condor: CREATE TRIGGER last_changes   BEFORE UPDATE ON status_table   FOR EACH ROW   WHEN (OLD.* IS DISTINCT FROM NEW.*) try to exclude the column lastchange from the comparison. Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com

Re: How to avoid UPDATE on same data in table ?

2020-02-02 Thread Andreas Kretschmer
Am 02.02.20 um 14:37 schrieb Andreas Kretschmer: Am 02.02.20 um 10:24 schrieb Condor: CREATE TRIGGER last_changes   BEFORE UPDATE ON status_table   FOR EACH ROW   WHEN (OLD.* IS DISTINCT FROM NEW.*) try to exclude the column lastchange from the comparison. test=*# select ctid, * from

Re: How to avoid UPDATE on same data in table ?

2020-02-02 Thread Tom Lane
Condor writes: > I'm using PostgreSQL 12.1 and trying to avoid update on table when data > is the same. I read somewhere if UPDATE is with the same data SQL server > on system level does not do update on table but don't know if that is > true or not. It is not, at least not for PG (can't say a

Re: How to avoid UPDATE on same data in table ?

2020-02-02 Thread Andreas Kretschmer
Am 02.02.20 um 18:18 schrieb Tom Lane: https://www.postgresql.org/docs/current/functions-trigger.html regards, tom lane cool. Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com

Re: How to avoid UPDATE on same data in table ?

2020-02-02 Thread Adrian Klaver
On 2/2/20 1:24 AM, Condor wrote: Hello, I'm using PostgreSQL 12.1 and trying to avoid update on table when data is the same. I read somewhere if UPDATE is with the same data SQL server on system level does not do update on table but don't know if that is true or not. If that is not true I do

Restrict connection from pgadmin.

2020-02-02 Thread Pawan Sharma
Hi All, Is there any way to restrict the connection only from pgadmin??? The same user can connect through application but can't from pgadmin.. Or any logon triggers..???