{"id":3263,"date":"2021-10-09T07:21:38","date_gmt":"2021-10-09T06:21:38","guid":{"rendered":"https:\/\/kudzia.eu\/b\/?p=3263"},"modified":"2021-10-09T09:56:07","modified_gmt":"2021-10-09T08:56:07","slug":"crude-way-to-restore-postgresql-database-dump-to-table-with-a-different-name","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2021\/10\/crude-way-to-restore-postgresql-database-dump-to-table-with-a-different-name\/","title":{"rendered":"crude way to restore postgresql database dump to table with a different name"},"content":{"rendered":"<p>i needed to restore specific table, backed up via pg_dump, to the same database \/ schema but under different name. that&#8217;s what i&#8217;ve done<\/p>\n<p><code><br \/>\npv dump.zstd|pzstd -dc - |sed 's\/name_of_original_table\/name_of_renamed_table\/g'|su - postgres -c 'psql dbname'<br \/>\n<\/code><\/p>\n<p>this only works if all constrains \/ indices have in their name name of the original table. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>i needed to restore specific table, backed up via pg_dump, to the same database \/ schema but under different name. that&#8217;s what i&#8217;ve done pv dump.zstd|pzstd -dc &#8211; |sed &#8216;s\/name_of_original_table\/name_of_renamed_table\/g&#8217;|su &#8211; postgres -c &#8216;psql dbname&#8217; this only works if all constrains \/ indices have in their name name of the original table.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[114],"class_list":["post-3263","post","type-post","status-publish","format-standard","hentry","category-unimportant","tag-postgresql"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=3263"}],"version-history":[{"count":2,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3263\/revisions"}],"predecessor-version":[{"id":3265,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3263\/revisions\/3265"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=3263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=3263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=3263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}