Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id BC248B5DBF1 for ; Tue, 9 Aug 2011 02:18:04 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 09351-02 for ; Tue, 9 Aug 2011 05:17:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtp1.mail.ru (smtp1.mail.ru [94.100.176.129]) by mail.postgresql.org (Postfix) with ESMTP id 6AA3DB5DBCB for ; Tue, 9 Aug 2011 02:17:58 -0300 (ADT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:In-Reply-To:References:Cc:To:From; bh=uDcL+7iX+WmzT+Z2k1ddfUyE+EQPJASCxt2Zexyr9ec=; b=j5eO7JSPpF/KRTyuuJQ61TIYYnHm8zCSCNDA+tBBTgXF03lzogXRxI2CgcplaPGWFeVImUuuuXn00pStr0SjLopQW6Fj23sKSCAWR5Dl7I9ArocmAU4rc5Saj+NZVsBV; Received: from [180.183.160.156] (port=16477 helo=ws) by smtp1.mail.ru with asmtp id 1QqehP-0002YI-00; Tue, 09 Aug 2011 09:17:56 +0400 From: "ai" To: "'Tom Lane'" Cc: References: <201108082022.p78KM2jZ050528@wwwmaster.postgresql.org> <6103.1312866140@sss.pgh.pa.us> In-Reply-To: <6103.1312866140@sss.pgh.pa.us> Subject: Re: BUG #6155: literal definition of arrays with double qoutes leads to error Date: Tue, 9 Aug 2011 12:17:49 +0700 Message-ID: <01fc01cc5653$b1b95810$152c0830$@mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHwCF2DEUPPJCpYIESC727thXQR0QGZLupClL/KGMA= Content-Language: ru X-Spam: Not detected X-Mras: Ok X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201108/77 X-Sequence-Number: 30889 Ok, thanks! I found out this issue a three years ago and then there isn't such explanation... (all this time I've used some workaround) my mistake, that I didn't look at the new manual before I reported this issue =( My apologies for wasting your time =( Best Regards, Alex -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us] Sent: Tuesday, August 09, 2011 12:02 PM To: listar Cc: pgsql-bugs@postgresql.org Subject: Re: [BUGS] BUG #6155: literal definition of arrays with double qoutes leads to error "listar" writes: > SELECT ('{string "with" double quotes}'::text[])[1] as value; > gives: > ERROR: malformed array literal: "{string "with" double quotes}" > LINE 1: SELECT ('{string "with" double quotes}'::text[])[1] as value... > ^ This is not a bug; that value does not follow the documented rules for array literals. Per the manual: As shown previously, when writing an array value you can use double quotes around any individual array element. You must do so if the element value would otherwise confuse the array-value parser. For example, elements containing curly braces, commas (or the data type's delimiter character), double quotes, backslashes, or leading or trailing whitespace must be double-quoted. Empty strings and strings matching the word NULL must be quoted, too. To put a double quote or backslash in a quoted array element value, use escape string syntax and precede it with a backslash. Alternatively, you can avoid quotes and use backslash-escaping to protect all data characters that would otherwise be taken as array syntax. An example of correct format is regression=# select E'{"string \\"with\\" double quotes"}'::text[]; text ----------------------------------- {"string \"with\" double quotes"} (1 row) Frequently it's easier to use an array[] constructor: regression=# select array['string "with" double quotes'::text]; array ----------------------------------- {"string \"with\" double quotes"} (1 row) regards, tom lane