class PgPartitions::SQL::Function

Public Instance Methods

to_sql() click to toggle source
# File lib/pg_partitions/sql.rb, line 41
      def to_sql
        <<~SQL
          CREATE OR REPLACE FUNCTION #{name}()
          RETURNS TRIGGER AS $$
          DECLARE
            result #{table}%rowtype;
          BEGIN
          #{body.indent(2)}
            RETURN result;
          END;
          $$
          LANGUAGE plpgsql;
        SQL
      end