Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DO $$
- DECLARE
- cols TEXT;
- BEGIN
- SELECT string_agg(column_name, ', ')
- INTO cols
- FROM information_schema.columns
- WHERE table_schema = '{your_schema}'
- AND table_name = '{your_table}'
- AND column_name NOT IN ('rating', '_id'); -- as example
- EXECUTE format(
- 'INSERT INTO {your_schema}.{your_table} (rating, %s)
- SELECT ''Отозв'',%s
- FROM {your_schema}.{your_table}
- WHERE rating NOT LIKE ''%%Отозв%%'' -- as example
- AND rating != ''NR''
- AND _date >= ''2022-04-01'';', -- as example
- cols, cols
- );
- END $$;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement