Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ovL1Z-0007ui-NX for pgsql-admin@arkaria.postgresql.org; Wed, 16 Nov 2022 16:12:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ovL1Y-0001wc-9k for pgsql-admin@arkaria.postgresql.org; Wed, 16 Nov 2022 16:12:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ovL1X-0001wT-Jq for pgsql-admin@lists.postgresql.org; Wed, 16 Nov 2022 16:12:27 +0000 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ovL1S-0004kg-Va for pgsql-admin@lists.postgresql.org; Wed, 16 Nov 2022 16:12:26 +0000 Received: by mail-qt1-x82d.google.com with SMTP id z6so10974014qtv.5 for ; Wed, 16 Nov 2022 08:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=Ybl+GfybmI98C7bJI1nUerO8r5TqcT1shzUkyi/RSXA=; b=RV8+46GlfaMS3wMbHIAR0+Hp8Rpy4o4NZTF0pz+Mp4d9glS62hGS3GukUJSeJCdqXz Hdxv86QFIkaBWaUmOIz7sIwSMgIemJBVkgFhaLMJpWELqm7nPjlKYfEjtv/+7hlzAGQ8 lXgpLTqKmSrXkmtaQPyQ7FlwA7HzReUw0W5JgEy0+q2JJbnR6N9jT5O54P5yOkNIkD4r RqhPRLVpp5Sypxof2bT8ZLToGyoyt6bjqS1T2dfuAlfdFPq2WBH3daemkXw1EV0TiEUP xjjA3cSjt2XX9ElRLZlnPdDZ7mhZgwoWfNcWbJZczcqzYML7TcOCUELjsQ9Z6/MJnwXL OWCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Ybl+GfybmI98C7bJI1nUerO8r5TqcT1shzUkyi/RSXA=; b=TGw3uJDnvq7L9C/HSPx4xyILZ0V0/dX6oqQTnjT+rjYpQuEznDhpGaYQG4H07imaSu 5EY0L22pgN4AZrg27wQ03TxEg8tyW5uo4CBTsSrJLOPs54eZVxPpukKVQgNvqdmsXm/6 Pxg4n5gDNgGJMMXtxpAyNt6H79PZI/4jQT/5Vc1yt1nl+3JvfWJsCbnYwCgkJLq6xDLX 2jS2RIbu+S6oQ8dKZrUF70F3SOQy4kYn8uFdV744jOYFh+vi4h3Nqy15DBz+EOZxx5hm wsT9fulvXYOz01mkb++hk3RSGfXtm2vkH4vLXJbg5JPZSKd/eidGh/M30Lho1EBRNbuv e0LA== X-Gm-Message-State: ANoB5pm8MukjhVIil1gMukngyb6kKKAJ7yEvJix0Eg+0hgTeMFW6Wt// bZUgmgCeJh2ZyxZGq06T+vta/oen8Ao= X-Google-Smtp-Source: AA0mqf65CcrSPpQz2Mz2hvRIGUwP28oZOKPf87mhQ4kWOQowVGcB/BxWDB0TEjlb3H6kScUJ1+e5GA== X-Received: by 2002:ac8:4602:0:b0:3a4:f6a5:6bc9 with SMTP id p2-20020ac84602000000b003a4f6a56bc9mr21367765qtn.43.1668615141948; Wed, 16 Nov 2022 08:12:21 -0800 (PST) Received: from ?IPV6:2600:1700:bd2c:b810::43? ([2600:1700:bd2c:b810::43]) by smtp.googlemail.com with ESMTPSA id i17-20020ac85c11000000b00397e97baa96sm9091051qti.0.2022.11.16.08.12.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Nov 2022 08:12:21 -0800 (PST) Content-Type: multipart/alternative; boundary="------------cM3VUxcuq6kA4KdyA0dMKN2y" Message-ID: <27d37670-c38f-69f9-9a9b-52a1775b32a0@gmail.com> Date: Wed, 16 Nov 2022 10:12:20 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: backup to partitioned table Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------cM3VUxcuq6kA4KdyA0dMKN2y Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/16/22 09:56, Erik Serrano wrote: > Hello Guys, > I have a case that I would like you to help me with. > > I have a partitioned table in postgresql version 9,5 to which I select and > it returns data perfectly, but when I want to make a backup of the table, > it only saves the structure without records. > It should be noted that I am not making a backup of the structure, but of > the data or complete, but it does not back up the data anyway. > When consulting the administrator, he informs me that it is a partitioned > table and that it is always zero, but the data is in its "daughter" tables > and that the select that it returns is the information that is housed in > all its daughter tables. That is correct. > > Now, given this, I wanted to know if there is any way to make a backup of > the table that throws all the data from its child tables *into a flat file*. Flat file as in a CSV file? > > Is it possible to perform this action? If you want to export it to a CSV (or tab-separated, etc, etc) flat file, then -- if using psql, use the COPY or \COPY command; instead of simply specifying a table name, copy the *query* (SELECT * FROM parent_table). If that's not what you mean, please clarify. -- Angular momentum makes the world go 'round. --------------cM3VUxcuq6kA4KdyA0dMKN2y Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 11/16/22 09:56, Erik Serrano wrote:
Hello Guys, 
I have a case that I would like you to help me with.

I have a partitioned table in postgresql version 9,5 to which I select and it returns data perfectly, but when I want to make a backup of the table, it only saves the structure without records.
It should be noted that I am not making a backup of the structure, but of the data or complete, but it does not back up the data anyway.
When consulting the administrator, he informs me that it is a partitioned table and that it is always zero, but the data is in its "daughter" tables and that the select that it returns is the information that is housed in all its daughter tables.

That is correct.


Now, given this, I wanted to know if there is any way to make a backup of the table that throws all the data from its child tables into a flat file.

Flat file as in a CSV file?


Is it possible to perform this action?

If you want to export it to a CSV (or tab-separated, etc, etc) flat file, then -- if using psql, use the COPY or \COPY command; instead of simply specifying a table name, copy the query (SELECT * FROM parent_table).

If that's not what you mean, please clarify.

--
Angular momentum makes the world go 'round.
--------------cM3VUxcuq6kA4KdyA0dMKN2y--