Received: from brasileiro.net (slxwy.dorms.usu.edu [129.123.236.160]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fA1JucP01201 for ; Thu, 1 Nov 2001 14:56:38 -0500 (EST) (envelope-from roberto@brasileiro.net) Received: from roberto by brasileiro.net with local (Exim 3.32 #1 (Debian)) id 15zNx2-0005Nw-00; Thu, 01 Nov 2001 12:56:32 -0700 Date: Thu, 1 Nov 2001 12:56:32 -0700 From: Roberto Mello To: Edward Grabczewski Cc: pgsql-sql@postgresql.org Subject: Re: PL/pgSQL syntax for strings Message-ID: <20011101125632.A20330@cc.usu.edu> References: <9rru48$8gh$1@news.tht.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9rru48$8gh$1@news.tht.net> User-Agent: Mutt/1.3.23i X-Archive-Number: 200111/26 X-Sequence-Number: 5411 On Thu, Nov 01, 2001 at 04:48:29PM +0000, Edward Grabczewski wrote: > > DROP FUNCTION threedpoint (float,float,float, float,float,float); > CREATE FUNCTION threedpoint (float,float,float,float,float,float) > RETURNS text > AS 'DECLARE > x1 ALIAS FOR $1; > y1 ALIAS FOR $2; > z1 ALIAS FOR $3; > x2 ALIAS FOR $4; > y2 ALIAS FOR $5; > z2 ALIAS FOR $6; > BEGIN > INSERT INTO rtest(xz,yz,xy) > VALUES ( \'(0,2), (1,3)\', > \'(1,2), (2,3)\', > \'(0,1), (1,2)\'); > RETURN null; > END;' > LANGUAGE 'plpgsql'; > > SELECT threedpoint(100,200,300,400,500,600); Why do you pass all those variables to the function if you don't use them? It doesn't make any sense to me. As the documentation for PL/pgSQL clearly states with several examples, you have to double the quotes in strings> INSERT INTO rtest(xz,yz,xy) VALUES (''(0,2), (1,3)'', ''(1,2), (2,3)'', ''(0,1), (1,2)''); I don't know if the \' way of escaping quotes works. I never tried within a PL/pgSQL function. My guess is that it doesn't. -Roberto -- +----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+ Roberto Mello - Computer Science, USU - http://www.brasileiro.net http://www.sdl.usu.edu - Space Dynamics Lab, Developer My inferiority complexes aren't as good as yours.