Re: IN List operator , where list of values are over a number of lines

Pavel Stehule <pavel.stehule@gmail.com>

From: Pavel Stehule <pavel.stehule@gmail.com>
To: "White, Ian Keith" <Ian.White@ncratleos.com>
Cc: "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2025-10-01T18:16:26Z
Lists: pgsql-bugs
Hi

st 1. 10. 2025 v 19:50 odesílatel White, Ian Keith <Ian.White@ncratleos.com>
napsal:

> Hi
>
>
>
> We have noticed a quirk in the IN list operator where the list of values
> are over several lines , but some have missing comma separators.
>
> The command should fail, however it executes only returning certain values.
>
>
>
> Create table, insert vales, show values , select using IN List
>
>
>
> First query  errors as expected , Second executes with out error!
> Returning A & F .
>
>
>
> Details of server .
>
>
>
> Attached is the sql that I ran
>
>
>
> Please investigate
>
>
>
> Many Thanks Ian White
>
> Member British Computer Society
>
>
>
> [image: ncr corporation]
>
> Oracle & Postgres Database Administrator & Perfomance Expert.
>
> Based London
>
> Ian.White@ncratleos.com
>
>
>

It is effect of multiline SQL strings

(2025-10-01 20:07:45) postgres=# select 'a' 'hoj';
ERROR:  syntax error at or near "'hoj'"
LINE 1: select 'a' 'hoj';
                   ^

but

(2025-10-01 20:08:38) postgres=# select 'a'
postgres-# 'hoj';
┌──────────┐
│ ?column? │
╞══════════╡
│ ahoj     │
└──────────┘
(1 row)

https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS

Regards

Pavel