From: | Rick Parrish <ai5jt(at)unitrunker(dot)net> |
---|---|
To: | bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | psql include text file with bom |
Date: | 2023-11-26 05:46:37 |
Message-ID: | 81ca2b25-6b3a-499a-9a09-2dd21253c2cb@unitrunker.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2023-11-26 07:36:57 | Re: BUG #18210: libpq: PQputCopyData sometimes fails in non-blocking mode over GSSAPI encrypted connection |
Previous Message | Nikolay Shaplov | 2023-11-24 18:25:02 | Re: BUG #18214: poly_contain (@>) hangs forever for input data with zeros and infinities |