lib/pgslice/cli/add_partitions.rb in pgslice-0.5.0 vs lib/pgslice/cli/add_partitions.rb in pgslice-0.6.0
- old
+ new
@@ -94,9 +94,12 @@
partitions = (table.partitions + added_partitions).uniq(&:name).sort_by(&:name)
partitions.each do |partition|
day = partition_date(partition, name_format)
+ # note: does not support generated columns
+ # could support by listing columns
+ # but this would cause issues with schema changes
sql = "(NEW.#{quote_ident(field)} >= #{sql_date(day, cast)} AND NEW.#{quote_ident(field)} < #{sql_date(advance_date(day, period, 1), cast)}) THEN
INSERT INTO #{quote_table(partition)} VALUES (NEW.*);"
if day.to_date < today
past_defs << sql