Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 5602E9FBE49 for ; Tue, 30 Oct 2007 17:57:36 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 42676-01 for ; Tue, 30 Oct 2007 17:57:20 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.233]) by postgresql.org (Postfix) with ESMTP id 1D4A19FA552 for ; Tue, 30 Oct 2007 17:57:22 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 68so1288848wri for ; Tue, 30 Oct 2007 13:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=V72IyZYQA53E8AmIpOJHayYa3aQ4XupZvvjnJQkq41Y=; b=gkqrnMldfq6Tz45WjGwN3P/Bxzy8QKi+ZhDbLwRukZXHNrsj9TrTvsjCuVkweu3RUbo+3A/tUYezB6gc1UeyZF6VvQAH5lX1pYHkMxLo6keMayT5WZoq/eaAc7xG6QmQ/Cja2t/Cw3Vc/N/COh/t3TEnHY62fwmukOE7IV8YMF4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uuUL/Ko53tEEC7gxcNOmiDrnpHR/Hopevgr0CARRzTjtYqxWuCgA6/wEuUarkh4A/46hTOiVPwjPHg6yNckIiKWG5xzJGRMdvtS5/OJeps4V9l7sFpj5p31uRlwEZiPzcgRgTWvvf51JxGiyEoZWVrZUHagYhSx2CA+2D/QOU7k= Received: by 10.90.49.1 with SMTP id w1mr5893810agw.1193777842027; Tue, 30 Oct 2007 13:57:22 -0700 (PDT) Received: by 10.90.117.8 with HTTP; Tue, 30 Oct 2007 13:57:21 -0700 (PDT) Message-ID: Date: Tue, 30 Oct 2007 15:57:21 -0500 From: "=?UTF-8?Q?Rodrigo_De_Le=C3=B3n?=" To: "Gerardo Herzig" Subject: Re: puzzled by SELECT INTO Cc: pgsql-sql@postgresql.org In-Reply-To: <47279757.50602@fmed.uba.ar> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <47279757.50602@fmed.uba.ar> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/151 X-Sequence-Number: 29523 On 10/30/07, Gerardo Herzig wrote: > Wreird enough to me, need some advice plz! CREATE OR REPLACE FUNCTION READ_WORDS(BIGINT, INT[]) RETURNS VARCHAR AS $$ DECLARE RETURNVALUE VARCHAR; BEGIN SELECT ARRAY_TO_STRING(ARRAY( SELECT WORD FROM WORDS WHERE PAGE_ID=$1 AND WORD_POSITION = ANY ($2) ), ' ') INTO RETURNVALUE; RETURN RETURNVALUE; END; $$ LANGUAGE PLPGSQL; SELECT READ_WORDS(99466, '{2994,2995,2996}'); See: http://www.postgresql.org/docs/8.2/static/arrays.html