bugfix: invalid bit/varbit input causes the log file to be unreadable

Поиск
Список
Период
Сортировка
От Quan Zongliang
Тема bugfix: invalid bit/varbit input causes the log file to be unreadable
Дата
Msg-id a120087c-4c88-d9d4-1ec5-808d7a7f133d@gmail.com
обсуждение исходный текст
Ответы Re: bugfix: invalid bit/varbit input causes the log file to be unreadable  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
The bit/varbit type input functions cause file_fdw to fail to read the 
logfile normally.

1. Server conf:
     server_encoding = UTF8
     locale = zh_CN.UTF-8

2. Create external tables using file_fdw

CREATE EXTENSION file_fdw;
CREATE SERVER pglog FOREIGN DATA WRAPPER file_fdw;

CREATE FOREIGN TABLE pglog (
      log_time timestamp(3) with time zone,
      user_name text,
      database_name text,
      process_id integer,
      connection_from text,
      session_id text,
      session_line_num bigint,
      command_tag text,
      session_start_time timestamp with time zone,
      virtual_transaction_id text,
      transaction_id bigint,
      error_severity text,
      sql_state_code text,
      message text,
      detail text,
      hint text,
      internal_query text,
      internal_query_pos integer,
      context text,
      query text,
      query_pos integer,
      location text,
      application_name text
) SERVER pglog
OPTIONS ( filename 'log/postgresql-2020-06-16_213409.csv',
      format 'csv');

It's normal to be here.

3. bit/varbit input
      select b'Ù';

The foreign table cannot be accessed. SELECT * FROM pglog will get:
invalid byte sequence for encoding "UTF8": 0xc3 0x22


The reason is that the error message in the bit_in / varbit_in function 
is output directly using %c. Causes the log file to not be decoded 
correctly.

The attachment is a patch.




Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Creating a function for exposing memory usage of backend process
Следующее
От: Michael Banck
Дата:
Сообщение: Re: [Patch] ALTER SYSTEM READ ONLY