Thursday, October 12, 2017

PostgreSQL: Display materialized view definition

select definition from pg_matviews where matviewname = 'mv_jersey_tap_data_3months_lag';

PostgreSQL: Find numeric rows w/o digit after decimal point

Source: Fetch records that are non zero after the decimal point in PostgreSQL
SELECT count(*) FROM t WHERE amount != trunc(amount)

Wednesday, October 11, 2017

Delete files older than file

Source: Delete files older than specific file
find __dir__ -type f ! -newer __file__ -delete