STL_REPLACEMENTS - Amazon Redshift

STL_REPLACEMENTS

Displays a log that records when invalid UTF-8 characters were replaced by the COPY command with the ACCEPTINVCHARS option. A log entry is added to STL_REPLACEMENTS for each of the first 100 rows on each node slice that required at least one replacement.

STL_REPLACEMENTS is visible to all users. Superusers can see all rows; regular users can see only their own data. For more information, see Visibility of data in system tables and views.

Note

STL_NESTLOOP only contains queries run on main clusters. It doesn't contain queries run on concurrency scaling clusters. To access queries run on both main and concurrency scaling clusters, we recommend that you use the SYS monitoring view SYS_COPY_REPLACEMENTS . The data in the SYS monitoring view is formatted to be easier to use and understand.

Table columns

Column name Data type Description
userid integer ID of the user who generated the entry.
query integer Query ID. The query column can be used to join other system tables and views.
slice integer Node slice number where the replacement occurred.
tbl integer Table ID.
starttime timestamp Start time in UTC for the COPY command.
session integer Session ID for the session performing the COPY command.
filename character(256) Complete path to the input file for the COPY command.
line_number bigint Line number in the input data file that contained an invalid UTF-8 character. A -1 indicates that the line number is not available, such as, when copying from a columnar data file.
colname character(127) First field that contained an invalid UTF-8 character.
raw_line character(1024) Raw load data that contained an invalid UTF-8 character.

Sample queries

The following example returns replacements for the most recent COPY operation.

select query, session, filename, line_number, colname from stl_replacements where query = pg_last_copy_id(); query | session | filename | line_number | colname ------+---------+-----------------------------------+-------------+-------- 96 | 6314 | s3://mybucket/allusers_pipe.txt | 251 | city 96 | 6314 | s3://mybucket/allusers_pipe.txt | 317 | city 96 | 6314 | s3://mybucket/allusers_pipe.txt | 569 | city 96 | 6314 | s3://mybucket/allusers_pipe.txt | 623 | city 96 | 6314 | s3://mybucket/allusers_pipe.txt | 694 | city ...