Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNIz9-00084N-W2 for pgsql-general@arkaria.postgresql.org; Wed, 23 Oct 2019 15:55:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iNIz8-0004Dj-J8 for pgsql-general@arkaria.postgresql.org; Wed, 23 Oct 2019 15:55:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNIz8-0004Db-7O for pgsql-general@lists.postgresql.org; Wed, 23 Oct 2019 15:55:42 +0000 Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNIz5-0004x8-4m for pgsql-general@lists.postgresql.org; Wed, 23 Oct 2019 15:55:41 +0000 Received: by mail-ot1-x344.google.com with SMTP id 60so17857190otu.0 for ; Wed, 23 Oct 2019 08:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=g3B/rlOM/2F2gkhabyM01fHbKy+IrzEKKB+PWtwIoh0=; b=ZTNpgV8JZKIscwbnlLljZIE6eF0SEhdmrK4DHAYoBltuy8ZyTGuw91f7KZlwYVvoQA rMGosQYWBTfuVFXAclQB35AwSeksMIMFD9hsGeakVrJ7gMebVo2mFfZlr5pitNREOuVk OUZkoNDIeq8a9Iz7xkBGdeI7X+QOE+zmVd3IiZjs5kAabANqLQ1u0cUmQYAK4KQkK69c hZ7u0XyD8KHWk14NQwgCHsYMh2ZGeWaPMcNi/aSwr2vawujbnJNeOZEfT7MRFf9NiEwk kUVsXtFLtTl9v9FReh4BeEX7PYOM4r1OsKRwSdRFjAjHuhBxTeqevsspEHfdoIPc2jk1 3hvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=g3B/rlOM/2F2gkhabyM01fHbKy+IrzEKKB+PWtwIoh0=; b=YAOUJyxgFYD2lar70P9rpZGgPTEdKna/KEyBkaNNwg1q+gOylbi0Rz1PyshzsLybyh kGf3VqH78DoRoV2BWnBSLuVAwcY2xwMxzgGs2hVqyv4lhzuSexwyP7MCBEndHpvAEnqU f30r59t7k8ee45QI02qbCoJ9fsJDo4QIw8pRW3UZKCTzfkwUwng8VOgKkD/tXYdKubPs A9OgZTiR8qHSJp5IvxT0MpwgNFGi//dMS0xF9UNyYf7aG645CGH/FllwaLGyGxfWCtY4 sevTMKfNFLX6PM7wwDMgjxisyet/l8VSjieQcKCIR3MGEP5U5fS+9jgq4CHNBf0//TW3 jxng== X-Gm-Message-State: APjAAAVAs65k75p1v1IQKuWEtGhJB2FdpdyLjZC/p6UEpC+ujRY7QKN7 ZZQKayYXo1Z1sC9/YApAScvYxYfH9OiMBA== X-Google-Smtp-Source: APXvYqw+K143WyEfCMsL8oz9Vfv6+zhEADVTMRn1p9KNN3o3hhOdWNiR0SXYp6zj7R7xI1n4G9hhuw== X-Received: by 2002:a05:6830:1d8a:: with SMTP id y10mr8340776oti.48.1571846137146; Wed, 23 Oct 2019 08:55:37 -0700 (PDT) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id 11sm6418786otg.62.2019.10.23.08.55.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Oct 2019 08:55:36 -0700 (PDT) Subject: Re: Is this a bug ? To: pgsql-general@lists.postgresql.org References: <6048315C-CE0E-482F-9F48-B300E4D7AC52@aol.com> From: Ron Message-ID: <9df3ba0d-974d-f13d-ec91-bc22c3ab362b@gmail.com> Date: Wed, 23 Oct 2019 10:55:35 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/23/19 10:51 AM, Geoff Winkless wrote: > On Wed, 23 Oct 2019 at 16:42, Ravi Krishna wrote: > >> select count(*) from bugtest where fld1 in ('a','b','c' >> 'd','e'); >> >> Note the missing comma after 'c'. >> >> PG takes it a syntactically right SQL and gives 3 as output. >> >> In SQLServer it errors out SQL Error [102] [S0001]: Incorrect syntax near 'd'. >> >> Can't believe this bug was never found before. We ended up wasting lot of time to figure this out. > Simplify: > > select 'a' > db-# 'b'; > ?column? > ---------- > ab > (1 row) > > This is not a bug. > > https://www.postgresql.org/docs/9.2/sql-syntax-lexical.html > > Two string constants that are only separated by whitespace with at > least one newline are concatenated and effectively treated as if the > string had been written as one constant. Then -- since the 'e' is separated from 'd' by a comma, the result should be "4", not "3". No doubt: it's a bug, no matter what the Pg devs say. -- Angular momentum makes the world go 'round.