Re: BUG #12242: No error - if there is no comma seperator

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: omkar1103(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #12242: No error - if there is no comma seperator
Date: 2014-12-16 01:15:38
Message-ID: 6851.1418692538@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

omkar1103(at)gmail(dot)com writes:
> Below script does not throw error
> =======================================
> SELECT
> claim_status,
> claim_key
> FROM tbl_claim
> WHERE claim_key IN
> (
> '1140799265'
> '2129945595'
> )

> Throws Error
> =======================================
> SELECT
> claim_status,
> claim_key
> FROM tbl_claim
> WHERE claim_key IN
> (
> '1140799265' '2129945595'
> )

Yup. This is not only not a bug, it's behavior required by the SQL
standard. Literal strings are concatenated automatically as long as
they're separated by a newline. This is mentioned in the PG docs
under 4.1.2.1. String Constants:
http://www.postgresql.org/docs/9.3/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS

(This is one of many decisions I'm sure the SQL committee would like
to have back, but we're pretty much stuck with it now.)

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-12-16 01:19:38 Re: BUG #12241: uninitialized value $lib_path
Previous Message Jonathon Lachlan-Haché 2014-12-15 21:28:14 Re: BUG #12228: Primary use-case of PERCENT_RANK not supported