Skip to content

Add all missing options to the Import/Export Data functionality, and update the syntax of the COPY command to align with the latest standards. #8583 #8689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions docs/en_US/export_data_using_query.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.. _export_data_using_query:

***************************************
`Export Data Using Query Dialog`:index:
***************************************

Use the *Export Data Using Query* dialog to copy data to a file.

The *Export Data Using Query* dialog organizes the export of data through the
*General*, *Options* and *Query* tabs.

.. image:: images/export_query_general.png
:alt: Export data using query dialog general tab
:align: center

Use the fields in the *General* tab to specify export preferences:

* Enter the name of the target file in the *Filename* field.
Optionally, select the *Browse* icon (ellipsis) to the right to navigate
into a directory and select a file.

* Use the drop-down listbox in the *Format* field to specify the file type.
Select:

* *binary* for a .bin file.
* *csv* for a .csv file.
* *text* for a .txt file.

* Use the drop-down listbox in the *Encoding* field to specify the type of
character encoding.

.. image:: images/export_query_options.png
:alt: Export data using query dialog options tab
:align: center

* Use the fields in the *Options* tab to specify additional information:

* Move the *Header* switch to the *Yes* position to include the table header
with the data rows. If you include the table header, the first row of the
file will contain the column names.
* If you are exporting data, specify the delimiter that will separate the
columns within the target file in the *Delimiter* field. The separating
character can be a colon, semicolon, a vertical bar, or a tab.
* Specify a quoting character used in the *Quote* field. Quoting can be
applied to string columns only (i.e. numeric columns will not be quoted)
or all columns regardless of data type. The character used for quoting can
be a single quote or a double quote.
* Specify a character that should appear before a data character that matches
the *QUOTE* value in the *Escape* field.
* Use the *NULL String* field to specify a string that will represent a null
value within the source or target file.

Click the *Query* tab to continue.

.. image:: images/export_query.png
:alt: Export data using query dialog query tab
:align: center

Use the fields in the *Query* tab to write the query that will be exported:

* Use the *Export Data Query* field to specifies A SELECT, VALUES, INSERT, UPDATE,
DELETE, or MERGE command whose results are to be copied .

* Use *Force Quote columns* field to forces quoting to be used for all non-NULL
values in each specified column. NULL output is never quoted. This is a creatable
select control. If you would like to quote all columns then provide only '*' in
the field.

After completing the *Export Data Using Query* dialog, click the *OK* button to
perform the export. pgAdmin will notify you when the background
process completes:

.. image:: images/export_query_complete.png
:alt: Export data using query completion notification
:align: center


Use the *View Processes* button on the notification to open the *Process
Watcher* and review detailed information about the execution of the command
that performed the export:

Use the **End Process** button to end the Export process.

.. image:: images/export_query_pw.png
:alt: Export data using query process watcher
:align: center

.. note:: If you are running *pgAdmin* in *Server Mode* you can click on the |sm_icon| icon in the process watcher window to open the file location in the Storage Manager. You can use the :ref:`Storage Manager <storage_manager>` to download the exported file on the client machine .


.. |sm_icon| image:: images/sm_icon.png
Binary file added docs/en_US/images/export_query.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/en_US/images/export_query_complete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/en_US/images/export_query_general.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/en_US/images/export_query_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/en_US/images/export_query_pw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/import_export_columns.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/import_export_complete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/import_export_general.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/import_export_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/import_export_pw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 32 additions & 8 deletions docs/en_US/import_export_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,29 @@ Use the fields in the *General* tab to specify import and export preferences:
* Use the drop-down listbox in the *Encoding* field to specify the type of
character encoding.

* use the drop-down listbox in the *On Error* field to specify how to behave
when encountering an error converting a columns input value into its data type.
An error_action value of stop means fail the command, while ignore means discard
the input row and continue with the next one. The default is stop. This option is
available from PG/EPAS version 17 and above.

* use the drop-down listbox in the *Log Verbosity* field to specify the amount
of messages emitted by a COPY command: default or verbose. This is currently
used in Import only when ON_ERROR option is set to ignore. This option is
available from PG/EPAS version 17 and above.

.. image:: images/import_export_options.png
:alt: Import Export data dialog options tab
:align: center

* Use the fields in the *Options* tab to specify additional information:

* Move the *OID* switch to the *Yes* position to include the *OID* column.
The *OID* is a system-assigned value that may not be modified. The default
is *No*.
* Move the *Header* switch to the *Yes* position to include the table header
with the data rows. If you include the table header, the first row of the
file will contain the column names.
* Move the *Freeze* switch to the *Yes* position to requests copying the
data with rows already frozen, just as they would be after running the
VACUUM FREEZE command.
* If you are exporting data, specify the delimiter that will separate the
columns within the target file in the *Delimiter* field. The separating
character can be a colon, semicolon, a vertical bar, or a tab.
Expand All @@ -54,8 +65,11 @@ Use the fields in the *General* tab to specify import and export preferences:
be a single quote or a double quote.
* Specify a character that should appear before a data character that matches
the *QUOTE* value in the *Escape* field.
* Use the *NULL Strings* field to specify a string that will represent a null
* Use the *NULL String* field to specify a string that will represent a null
value within the source or target file.
* Use the *Default String* field to specify a string that will represent a default value.
Each time the string is found in the input file, the default value of the corresponding
column will be used. This option is available from PG/EPAS version 16 and above.

Click the *Columns* tab to continue.

Expand All @@ -71,29 +85,39 @@ or exported:
the left of the column name. Click an empty spot inside the field to access
the drop-down list.

* If enabled, click inside the *Force Quote columns* field to forces quoting
to be used for all non-NULL values in each specified column. NULL output is
never quoted. To delete a column, click the *x* to the left of the column name.

* If enabled, click inside the *NOT NULL columns* field to select one or more
columns that will not be checked for a NULL value. To delete a column, click
the *x* to the left of the column name.

* If enabled, click inside the *NULL columns* field to match the specified columns
values against the null string, even if it has been quoted, and if a match is
found set the value to NULL. To delete a column, click the *x* to the left of the
column name.

After completing the *Import/Export data* dialog, click the *OK* button to
perform the import or export. pgAdmin will inform you when the background
perform the import or export. pgAdmin will notify you when the background
process completes:

.. image:: images/import_export_complete.png
:alt: Import Export data completion notification
:align: center

Use the **Stop Process** button to stop the Import/Export process.

Use the *Click here for details* link on the notification to open the *Process
Use the *View Processes* button on the notification to open the *Process
Watcher* and review detailed information about the execution of the command
that performed the import or export:

Use the **End Process** button to end the Import/Export process.

.. image:: images/import_export_pw.png
:alt: Import Export data process watcher
:align: center

.. note:: If you are running *pgAdmin* in *Server Mode* you can click on the |sm_icon| icon in the process watcher window to open the file location in the Storage Manager. You can use the :ref:`Storage Manager <storage_manager>` to download the backup file on the client machine .
.. note:: If you are running *pgAdmin* in *Server Mode* you can click on the |sm_icon| icon in the process watcher window to open the file location in the Storage Manager. You can use the :ref:`Storage Manager <storage_manager>` to download the exported file on the client machine .


.. |sm_icon| image:: images/sm_icon.png
1 change: 1 addition & 0 deletions docs/en_US/management_basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ granting user privileges, and performing VACUUM, ANALYZE and REINDEX functions.
add_restore_point_dialog
change_password_dialog
grant_wizard
export_data_using_query
import_export_data
maintenance_dialog
storage_manager
Loading