Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id B3C521337B5D for ; Thu, 3 Feb 2011 08:01:50 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 57372-05 for ; Thu, 3 Feb 2011 12:01:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtpcorp.com (smtpcorp.com [174.143.60.32]) by mail.postgresql.org (Postfix) with ESMTP id 72DEB1337B49 for ; Thu, 3 Feb 2011 08:01:43 -0400 (AST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=main; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:Message-ID:Date:Subject:From:To; bh=ULKAdoqrgpkLayxkXyu/sBds/G29eCyalyzOmFivp6o=; b=r8OP5+fbDgdJ+LauWaGovtBPhZPpnZXAh3f6CbXpKKRfYHviNFXTilUGhImFtqKFK3GMCL+SZDk8fBvJPhtMQkNuMZxtBLrAxrhBoiPi6QQpA63zFYCjfiGEhPHwFgTA; Received: from ip-118-90-139-176.xdsl.xnet.co.nz ([118.90.139.176] helo=gonzo) by smtpcorp.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.70) id 1Pkxsg-0007J3-4y; mid 144 for pgsql-bugs@postgresql.org; Thu, 03 Feb 2011 12:01:46 +0000 Received: from news by gonzo with local (Exim 4.72) (envelope-from ) id 1PkxsS-000334-Go for pgsql-bugs@postgresql.org; Fri, 04 Feb 2011 01:01:32 +1300 To: pgsql-bugs@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.bugs Subject: Re: Feature request: include script file into function body Date: 3 Feb 2011 12:01:32 GMT Organization: Dis (not Dat) Organisation Lines: 28 Message-ID: References: <20110201112120.GA1327@cashmere.aip.de> <26900.1296576145@sss.pgh.pa.us> <20110201164422.GA3023@cashmere.aip.de> <4D47EB12020000250003A0EE@gw.wicourts.gov> <20110201185004.GA7511@cashmere.aip.de> <4D480622020000250003A10C@gw.wicourts.gov> <1191.1296588973@sss.pgh.pa.us> <20110201195915.GA8252@cashmere.aip.de> <4D481423020000250003A123@gw.wicourts.gov> <20110202111808.GA21282@cashmere.aip.de> NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reversiblemaps.ath.cx 1296734492 11553 127.0.0.1 (3 Feb 2011 12:01:32 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-18 (Linux) X-Smtpcorp-Track: 21993198.1.19910365 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201102/49 X-Sequence-Number: 29321 On 2011-02-02, Steve White wrote: > Hi, Robert, > > I made a file 'yadda_yadda.py' containing only the line: > print 'hello world' > >==================================================================== > d=# \set yadda `cat yadda_yadda.py` > d=# \echo :yadda > print 'hello world' >==================================================================== > But the :'yadda'; produces an error--it seems the variable yadda isn't > expanded in the presence of the quotes. yes, \set doesn't quote content \set yadda '''' `sed -e "s/'/''/g" -e 's/\\/\\\\/g' < yadda_yadda.py` '''' CREATE FUNCTION yadda_yadda() returns text language plpythonu AS E:yadda; this is not much help for windows users though. BTW I found that sed command on the psql man page. -- ⚂⚃ 100% natural