Skip to content

Instantly share code, notes, and snippets.

@Carw
Last active August 19, 2016 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Carw/5c1232cd74f33d12fbcec32fbcd17df2 to your computer and use it in GitHub Desktop.
Save Carw/5c1232cd74f33d12fbcec32fbcd17df2 to your computer and use it in GitHub Desktop.

##Установка локали

Генерация русской локали locale-gen --lang ru

Включение русской локали export LANG=ru_RU.UTF-8

Вывод ошибок на английском export LC_MESSAGES=C

Установка счетчиков последовательностей

SELECT 'SELECT SETVAL(' ||
     quote_literal(quote_ident(PGT.schemaname) || '.' || quote_ident(S.relname)) ||
     ', COALESCE(MAX(' ||quote_ident(C.attname)|| '), 1) ) FROM ' ||
     quote_ident(PGT.schemaname)|| '.'||quote_ident(T.relname)|| ';'
FROM pg_class AS S,
     pg_depend AS D,
     pg_class AS T,
     pg_attribute AS C,
     pg_tables AS PGT
WHERE S.relkind = 'S'
     AND S.oid = D.objid
     AND D.refobjid = T.oid
     AND D.refobjid = C.attrelid
     AND D.refobjsubid = C.attnum
     AND T.relname = PGT.tablename
ORDER BY S.relname;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment