Skip to content

Instantly share code, notes, and snippets.

@siedovolosyi
Last active May 11, 2017 14:41
Show Gist options
  • Select an option

  • Save siedovolosyi/95433104dae9c678b3d99e881db50da9 to your computer and use it in GitHub Desktop.

Select an option

Save siedovolosyi/95433104dae9c678b3d99e881db50da9 to your computer and use it in GitHub Desktop.
DO $$DECLARE tables CURSOR FOR SELECT table_name FROM information_schema.columns WHERE column_name='country'; newName TEXT = 'al';BEGIN FOR broken_table IN tables LOOP EXECUTE 'UPDATE ' || broken_table.table_name || ' SET country = ''' || newName || ''''; END LOOP;END $$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment