Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id DD3DB9FBD28 for ; Tue, 7 Aug 2007 15:12:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 36802-04 for ; Tue, 7 Aug 2007 15:12:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mx1.ipf.is (mack.ipf.is [85.197.192.164]) by postgresql.org (Postfix) with ESMTP id B68179FBB96 for ; Tue, 7 Aug 2007 15:12:20 -0300 (ADT) Received: (qmail 7504 invoked by uid 1010); 7 Aug 2007 18:12:19 +0000 Received: from 88.149.106.19 by mack (envelope-from , uid 1008) with qmail-scanner-1.25-st-qms (clamdscan: 0.88.4/1639. spamassassin: 3.1.4. perlscan: 1.25-st-qms. Clear:RC:1(88.149.106.19):SA:0(-2.4/4.5):. Processed in 2.464202 secs); 07 Aug 2007 18:12:19 -0000 X-Antivirus-HIVE-Mail-From: gnari@hive.is via mack X-Antivirus-HIVE: 1.25-st-qms (Clear:RC:1(88.149.106.19):SA:0(-2.4/4.5):. Processed in 2.464202 secs Process 7495) Received: from dsl-149-106-19.hive.is (HELO ?192.168.1.33?) (88.149.106.19) by mx1.ipf.is with SMTP; 7 Aug 2007 18:12:16 +0000 Subject: Re: [SQL] Using function like where clause From: Ragnar To: Ranieri Mazili Cc: pgsql-general@postgresql.org, pgsql-sql@postgresql.org In-Reply-To: <46B77A2B.4090804@terra.com.br> References: <46B77A2B.4090804@terra.com.br> Content-Type: text/plain; charset=ISO-8859-1 Date: Tue, 07 Aug 2007 18:20:37 +0000 Message-Id: <1186510837.5778.403.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/367 X-Sequence-Number: 118216 On mán, 2007-08-06 at 16:44 -0300, Ranieri Mazili wrote: > 1) Can I use a function that will return a string in a where clause like > bellow? > > select * > from table > where my_function_making_where() > and another_field = 'another_think' you could have your function return a boolean instead of a string > 2) Can I use a function that will return a string to return the list of > columns that I want to show like below? > > select my_function_making_list_of_columns() > from table > where field_test = 'mydatum' no gnari