Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id EAB329FA2DF; Mon, 6 Aug 2007 16:57:45 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 38189-01-2; Mon, 6 Aug 2007 16:57:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mtai04.charter.net (mtai04.charter.net [209.225.8.184]) by postgresql.org (Postfix) with ESMTP id 9B1A29FA249; Mon, 6 Aug 2007 16:57:37 -0300 (ADT) Received: from aa04.charter.net ([10.20.200.156]) by mtai04.charter.net (InterMail vM.7.08.02.00 201-2186-121-20061213) with ESMTP id <20070806195734.WHHP19955.mtai04.charter.net@aa04.charter.net>; Mon, 6 Aug 2007 15:57:34 -0400 Received: from [10.0.1.3] (really [66.188.165.91]) by aa04.charter.net with ESMTP id <20070806195729.WVZG1254.aa04.charter.net@[10.0.1.3]>; Mon, 6 Aug 2007 15:57:29 -0400 In-Reply-To: <46B77A2B.4090804@terra.com.br> References: <46B77A2B.4090804@terra.com.br> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-general@postgresql.org, pgsql-sql@postgresql.org Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: [SQL] Using function like where clause Date: Mon, 6 Aug 2007 14:57:27 -0500 To: Ranieri Mazili X-Mailer: Apple Mail (2.752.2) X-Chzlrs: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/326 X-Sequence-Number: 118175 On Aug 6, 2007, at 14:44 , 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' Probably. What have you tried? What does the documentation say? If you're having trouble with a specific function, please provide the code and hopefully we can work it out. > 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' Probably not. What have you tried? What does the documentation say? A couple of minutes in psql would probably be faster than sending an email to the list. Michael Glaesemann grzm seespotcode net