Self-managing PostgreSQL partition tables
I am trying to make a self-managing partition table setup with Postgres. It all revolves around this function but I can't seem to get Postgres to accept my table names. Any ideas or examples of self-managing partition table trigger functions? My current function: DECLARE day integer; year integer; tablename text; startdate text; enddate text; BEGIN day:=date_part('doy',to_timestamp(NEW.date)); year:=date_part('year',to_timestamp(NEW.date)); tablename:='pings_'||year||'_'||day||'_'||NEW.id; -- RAISE EXCEPTION 'tablename=%',tablename; PERFORM 'tablename' FROM pg_tables WHERE 'schemaname'