Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 0EC9F6325DA for ; Mon, 5 Jul 2010 03:12:21 -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 17657-06 for ; Mon, 5 Jul 2010 06:12:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moon.antora.ru (moon.antora.ru [89.111.189.180]) by mail.postgresql.org (Postfix) with ESMTP id 2801D632C87 for ; Mon, 5 Jul 2010 03:12:12 -0300 (ADT) Envelope-to: pgsql-sql@postgresql.org Received: from moon.inner.space ([10.1.1.5] helo=moon.antora.ru) by moon.antora.ru with esmtp (Exim 4.67) (envelope-from ) id 1OVeuX-00075M-Mm for pgsql-sql@postgresql.org; Mon, 05 Jul 2010 10:12:09 +0400 Received: from [192.168.1.6] [178.34.185.189] by moon.antora.ru (Axigen) with (DHE-RSA-AES256-SHA encrypted) ESMTPSA id 1F3B50; Mon, 5 Jul 2010 10:12:09 +0400 Message-ID: <4C3177B8.3080803@bankir.ru> Date: Mon, 05 Jul 2010 10:12:08 +0400 From: silly sad User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20100111 Thunderbird/3.0 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-5 required=5 tests=BAYES_50=0.8 X-Spam-Level: X-Archive-Number: 201007/7 X-Sequence-Number: 34320 On 07/05/10 09:57, wrote: > Hi, > > How can I store Byte strings into a postgresql database. > Is there any special command to store it. How will be the sql query. there is only '\0' byte incapable to input-output. so u have to have it escaped at all costs _AND NOTHING MORE_. "escaped" doesn't mean "prefixed with backslash" ("backslash method" cause a zero-byte to pass SQL parser an to be actually stored, BUT the output will be corrupted, because of this zero-byte will be actually output) You may use the BYTEA type (similar to the TEXT but with different input-output) which effectively escapes zero-byte and a lot of other completely harmless bytes as well (probably to reach a better overhead) Or you may introduce a pair of your own escape rules. Unfortunately there are no way to influence The Pg Developers to get rid of the nasty god damned CSTRING off the input/output operations.