DEFINITIONS

Definitions More Info.
Definition ID898
TitlePOSTGRESQL
CategoryNOTES
DefinitionPostgresql dynamic query in COPY stament with psql command
Definition Descriptionhttps://stackoverflow.com/questions/52986216/postgresql-dynamic-query-in-copy-stament-with-psql-command/52987247#52987247

psql -U postgres -c ^
"COPY ( ^
SELECT format('REINDEX TABLE %s.%s', schemaname, relname) ^
FROM pg_stat_all_tables ^
ORDER BY n_dead_tup DESC) ^
TO 'E:\scripts\maintenance\reindex.sql'"

ANCAK TIRNAK ISARETINI DE KOYMAK ISTERSEK ASAGIDAKINI UYGULA

psql -U postgres -c ^
"COPY ( ^
SELECT format('REINDEX TABLE ""%s"".""%s"";', schemaname, relname) ^
FROM pg_stat_all_tables ^
ORDER BY n_dead_tup DESC) ^
TO 'E:\scripts\maintenance\reindex.sql'"
RecordBycunay
Record Date25-10-2018 14:18:45
Düzenle
Kopyala
Sil