Postgres Check If Table Has Rows To Repeat In Excel