psql include text file with bom

Поиск
Список
Период
Сортировка
От Rick Parrish
Тема psql include text file with bom
Дата
Msg-id 81ca2b25-6b3a-499a-9a09-2dd21253c2cb@unitrunker.net
обсуждение исходный текст
Ответы Re: psql include text file with bom
Список pgsql-bugs

Summary:

psql "include" or "\i" command chokes on UTF8 text files prefixed with BOM.

Steps to reproduce:

  1. create a UTF8 file with three byte BOM 'EF BB BF'.
  2. include the file from psql via the "include" or \i command.

Example output for file named "test.sql" below:

redacted-# \i test.sql
psql:test.sql:1: ERROR:  syntax error at or near ""
LINE 1: 

Background

https://en.wikipedia.org/wiki/Byte_order_mark

Some text editors save text to a file prefixed by a BOM or byte marker. This includes Visual Studio, VSCode and others. I think it would be reasonable for the include command to skip over any BOM found in the first two or three bytes of a file.

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