Skip to content

Instantly share code, notes, and snippets.

View FromSi's full-sized avatar
:octocat:

FromSi

:octocat:
  • @skycoach.gg
  • Nur-Sultan, Kazakhstan
  • 02:28 (UTC +05:00)
View GitHub Profile
@FromSi
FromSi / sequences_update.sql
Created July 4, 2024 09:35
Update All Sequences In PostgreSQL
with sequences as (
select *
from (
select table_schema,
table_name,
column_name,
replace(replace(replace(column_default, '::regclass)', ''), '''', ''), 'nextval(', 'public.') as col_sequence
from information_schema.columns
where table_schema not in ('pg_catalog', 'information_schema') and column_default ILIKE 'nextval(%'
) t