You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have special type of migrations, where I need to migrate large amounts of data after some DDL is changed. Because these tables are large, these scripts executed much faster when processed by parts, and also to prevent this huge work from being lost because of database timeout - I try to commit after every step.
Example
--/
create or replace procedure fill_volume_metadata(in STEP int default 100000)
as $$
declare
MAX_META_ID numeric(19);
beginselect coalesce(max(ID), 0) into MAX_META_ID from datevalues;
RAISE NOTICE 'MAX datevalues: % %', MAX_META_ID, E'\n';
FOR IDX IN1..MAX_META_ID BY STEP LOOP
RAISE NOTICE 'datevalues: %...% %', IDX, IDX + STEP -1, E'\n';
perform insert_volume_metadata(
DataValue
) from (
selectv.DataValuefrom datevalues v
wherev.ID>= IDX andv.ID< (IDX + STEP)
) v;
COMMIT;
END LOOP;
RAISE NOTICE 'datevalues finished: % %', MAX_META_ID, E'\n';
end;
$$ LANGUAGE plpgsql;
--//
CALL fill_volume_metadata();
drop procedure if exists fill_volume_metadata(in STEP int);
The above script works when executed with raw psql, but with migrate it throws transaction error, because multi statement is disabled and this is executed in single transaction. Currently I just execute these migrations with psql, and then perform migrate force.
-- +goose StatementBegin
CREATE OR REPLACE FUNCTION histories_partition_creation( DATE, DATE )
...
END; -- FUNCTION END
$$
language plpgsql;
-- +goose StatementEnd
If something like this will be supported, I could wrap my statements with these comments, and enable single statement mode.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I have special type of migrations, where I need to migrate large amounts of data after some DDL is changed. Because these tables are large, these scripts executed much faster when processed by parts, and also to prevent this huge work from being lost because of database timeout - I try to commit after every step.
Example
The above script works when executed with raw
psql
, but withmigrate
it throws transaction error, because multi statement is disabled and this is executed in single transaction. Currently I just execute these migrations withpsql
, and then performmigrate force
.Describe the solution you'd like
https://github.com/pressly/goose has nice solution for multistatement mode. In addition to
;
it recognizes blocksIf something like this will be supported, I could wrap my statements with these comments, and enable single statement mode.
The text was updated successfully, but these errors were encountered: