Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aOvaW-0004Pn-Q1 for pgsql-sql@arkaria.postgresql.org; Thu, 28 Jan 2016 23:02:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aOvaV-00008F-Ml for pgsql-sql@arkaria.postgresql.org; Thu, 28 Jan 2016 23:02:51 +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_SHA384:256) (Exim 4.84) (envelope-from ) id 1aOvaV-00007S-4g for pgsql-sql@postgresql.org; Thu, 28 Jan 2016 23:02:51 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aOvaR-0002nF-8A for pgsql-sql@postgresql.org; Thu, 28 Jan 2016 23:02:50 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 9CD0D20B01 for ; Thu, 28 Jan 2016 18:02:44 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Thu, 28 Jan 2016 18:02:44 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=Xyu7xxEK7Q0IRmFACvTcE/6mHWM=; b=Ljqd8H CS1MrMCXv7gx3Or3Tz37qrn9MERf/kzw/wnwxgzjiWT6ZyJGXVT6wk9PmsvATOkk V24tVE7UhgQavd9f8E14BA1oghy3kRIkJkIbQWfGgjqie0lOE1GZ2XLD1rQFvI60 YMViVG84tQpuAFT2nD/asT5dvJ1l7lLNgOBgk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=Xyu7xxEK7Q0IRmF ACvTcE/6mHWM=; b=iVvhDdz53BYy6apTAaq/2ICOmiBj5u3STcemv0Zvp19PgMJ z62i6TgQljXZZJx7Jy1uYk9sITNZUgLgsKxH94yXeLk8eUgKpjQ+X0v5V6ezmehu KQNCFEFlI95PR0S/5Ofc9bZkxSq7hfAS/4WMXru1pTuSNNWIvqzfJ2GUWw7E= X-Sasl-enc: kjGTDv1O2+NmNnOCI98Juwf78DXW4ZGzSipYJQB2D0DH 1454022164 Received: from [192.168.1.2] (65-102-182-223.tukw.qwest.net [65.102.182.223]) by mail.messagingengine.com (Postfix) with ESMTPA id D9C31C0001E; Thu, 28 Jan 2016 18:02:43 -0500 (EST) Subject: Re: insert a text file into a variable in order to insert into a bytea column To: Arthur Lewis , "David G. Johnston" References: <1374628469.7191030.1454020562643.JavaMail.root@hypermediasystems.com> Cc: pgsql-sql@postgresql.org From: Adrian Klaver Message-ID: <56AA9DD8.104@aklaver.com> Date: Thu, 28 Jan 2016 15:01:44 -0800 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1374628469.7191030.1454020562643.JavaMail.root@hypermediasystems.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 01/28/2016 02:36 PM, Arthur Lewis wrote: > Hi David, > Yes you're correct. The problem is caused by the back-ticks (`) Here is what I found in the docs about back-ticks > > "Within an argument, text that is enclosed in backquotes (`) is taken as a command line that is passed to the shell. The output of the command (with any trailing newline removed) replaces the backquoted text." Huh, I missed that in reading the docs. So: test-# \set stext `cat test.txt` test-# \echo :stext Test second line test-# \set stext `cat test.txt` '\n' test-# \echo :stext Test second line test-# New lesson learned. > > Arthur Lewis > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql