Skip to content

Commit 80cf6c7

Browse files
committed
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
Updated documentation. Add support for exporting table data based on a custom query. #8681
1 parent 5a50160 commit 80cf6c7

28 files changed

+1386
-219
lines changed
+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
.. _export_data_using_query:
2+
3+
***************************************
4+
`Export Data Using Query Dialog`:index:
5+
***************************************
6+
7+
Use the *Export Data Using Query* dialog to copy data to a file.
8+
9+
The *Export Data Using Query* dialog organizes the export of data through the
10+
*General*, *Options* and *Query* tabs.
11+
12+
.. image:: images/export_query_general.png
13+
:alt: Export data using query dialog general tab
14+
:align: center
15+
16+
Use the fields in the *General* tab to specify export preferences:
17+
18+
* Enter the name of the target file in the *Filename* field.
19+
Optionally, select the *Browse* icon (ellipsis) to the right to navigate
20+
into a directory and select a file.
21+
22+
* Use the drop-down listbox in the *Format* field to specify the file type.
23+
Select:
24+
25+
* *binary* for a .bin file.
26+
* *csv* for a .csv file.
27+
* *text* for a .txt file.
28+
29+
* Use the drop-down listbox in the *Encoding* field to specify the type of
30+
character encoding.
31+
32+
.. image:: images/export_query_options.png
33+
:alt: Export data using query dialog options tab
34+
:align: center
35+
36+
* Use the fields in the *Options* tab to specify additional information:
37+
38+
* Move the *Header* switch to the *Yes* position to include the table header
39+
with the data rows. If you include the table header, the first row of the
40+
file will contain the column names.
41+
* If you are exporting data, specify the delimiter that will separate the
42+
columns within the target file in the *Delimiter* field. The separating
43+
character can be a colon, semicolon, a vertical bar, or a tab.
44+
* Specify a quoting character used in the *Quote* field. Quoting can be
45+
applied to string columns only (i.e. numeric columns will not be quoted)
46+
or all columns regardless of data type. The character used for quoting can
47+
be a single quote or a double quote.
48+
* Specify a character that should appear before a data character that matches
49+
the *QUOTE* value in the *Escape* field.
50+
* Use the *NULL String* field to specify a string that will represent a null
51+
value within the source or target file.
52+
53+
Click the *Query* tab to continue.
54+
55+
.. image:: images/export_query.png
56+
:alt: Export data using query dialog query tab
57+
:align: center
58+
59+
Use the fields in the *Query* tab to write the query that will be exported:
60+
61+
* Use the *Export Data Query* field to specifies A SELECT, VALUES, INSERT, UPDATE,
62+
DELETE, or MERGE command whose results are to be copied .
63+
64+
* Use *Force Quote columns* field to forces quoting to be used for all non-NULL
65+
values in each specified column. NULL output is never quoted. This is a creatable
66+
select control. If you would like to quote all columns then provide only '*' in
67+
the field.
68+
69+
After completing the *Export Data Using Query* dialog, click the *OK* button to
70+
perform the export. pgAdmin will notify you when the background
71+
process completes:
72+
73+
.. image:: images/export_query_complete.png
74+
:alt: Export data using query completion notification
75+
:align: center
76+
77+
78+
Use the *View Processes* button on the notification to open the *Process
79+
Watcher* and review detailed information about the execution of the command
80+
that performed the export:
81+
82+
Use the **End Process** button to end the Export process.
83+
84+
.. image:: images/export_query_pw.png
85+
:alt: Export data using query process watcher
86+
:align: center
87+
88+
.. 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 .
89+
90+
91+
.. |sm_icon| image:: images/sm_icon.png

docs/en_US/images/export_query.png

122 KB
Loading

docs/en_US/images/export_query_complete.png

Loading
55.7 KB
Loading

docs/en_US/images/export_query_options.png

Loading

docs/en_US/images/export_query_pw.png

Loading
161 KB
Loading
28.3 KB
Loading
144 KB
Loading
138 KB
Loading
68.7 KB
Loading

docs/en_US/import_export_data.rst

+32-8
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,29 @@ Use the fields in the *General* tab to specify import and export preferences:
3333
* Use the drop-down listbox in the *Encoding* field to specify the type of
3434
character encoding.
3535

36+
* use the drop-down listbox in the *On Error* field to specify how to behave
37+
when encountering an error converting a columns input value into its data type.
38+
An error_action value of stop means fail the command, while ignore means discard
39+
the input row and continue with the next one. The default is stop. This option is
40+
available from PG/EPAS version 17 and above.
41+
42+
* use the drop-down listbox in the *Log Verbosity* field to specify the amount
43+
of messages emitted by a COPY command: default or verbose. This is currently
44+
used in Import only when ON_ERROR option is set to ignore. This option is
45+
available from PG/EPAS version 17 and above.
46+
3647
.. image:: images/import_export_options.png
3748
:alt: Import Export data dialog options tab
3849
:align: center
3950

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

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

6074
Click the *Columns* tab to continue.
6175

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

88+
* If enabled, click inside the *Force Quote columns* field to forces quoting
89+
to be used for all non-NULL values in each specified column. NULL output is
90+
never quoted. To delete a column, click the *x* to the left of the column name.
91+
7492
* If enabled, click inside the *NOT NULL columns* field to select one or more
7593
columns that will not be checked for a NULL value. To delete a column, click
7694
the *x* to the left of the column name.
7795

96+
* If enabled, click inside the *NULL columns* field to match the specified columns
97+
values against the null string, even if it has been quoted, and if a match is
98+
found set the value to NULL. To delete a column, click the *x* to the left of the
99+
column name.
100+
78101
After completing the *Import/Export data* dialog, click the *OK* button to
79-
perform the import or export. pgAdmin will inform you when the background
102+
perform the import or export. pgAdmin will notify you when the background
80103
process completes:
81104

82105
.. image:: images/import_export_complete.png
83106
:alt: Import Export data completion notification
84107
:align: center
85108

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

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

114+
Use the **End Process** button to end the Import/Export process.
115+
92116
.. image:: images/import_export_pw.png
93117
:alt: Import Export data process watcher
94118
:align: center
95119

96-
.. 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 .
120+
.. 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 .
97121

98122

99123
.. |sm_icon| image:: images/sm_icon.png

docs/en_US/management_basics.rst

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ granting user privileges, and performing VACUUM, ANALYZE and REINDEX functions.
1414
add_restore_point_dialog
1515
change_password_dialog
1616
grant_wizard
17+
export_data_using_query
1718
import_export_data
1819
maintenance_dialog
1920
storage_manager

0 commit comments

Comments
 (0)